home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume12 / xcal / patch1 < prev    next >
Encoding:
Internet Message Format  |  1991-05-06  |  78.7 KB

  1. Path: uunet!elroy.jpl.nasa.gov!usc!apple!veritas!amdcad!sun!exodus!hillside.co.uk
  2. From: pc@hillside.co.uk (Peter Collinson)
  3. Newsgroups: comp.sources.x
  4. Subject: v12i081: xcal3.2, Patch1, Part01/01
  5. Message-ID: <12926@exodus.Eng.Sun.COM>
  6. Date: 7 May 91 05:12:33 GMT
  7. References: <csx-12i081:xcal@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 2976
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: Peter Collinson <pc@hillside.co.uk>
  13. Posting-number: Volume 12, Issue 81
  14. Archive-name: xcal/patch1
  15. Patch-To: xcal: Volume 10, Issue 99-101
  16.  
  17. --------
  18. Xcal is a calendar program. It generally sits on your screen
  19. displaying today's date - the format of this can be tailored to your
  20. taste.
  21.  
  22. The diffs below should only by applied to xcal 3.2 posted to the net
  23. as comp.sources.x, Volume 10 Issue 99-101. If you are unsure of the
  24. version, check the file version.c - this should contain the full truth.
  25.  
  26. Oh yes, what are the changes? These are documented in the CHANGES file
  27. (see below) - now more detailed because of someone's complaints.
  28.  
  29. I did this all in January and had hoped to add a number of more
  30. things to xcal and have a formidable mail folder full of fixes,
  31. suggestions and ideas. I do want to do something when the date strip
  32. gets too big for the screen, this is probably the biggest complaint.
  33.  
  34. I will eventually get around to dealing with fixes and new ideas. This
  35. patch set is being produced mostly because a number of people have
  36. asked for a way of dealing with regular events. Xcal purists will find
  37. that the basic date box now contains todays day as a string. The box
  38. grows alarmingly. You can mimic previous behaviour by using resources.
  39. Personally, I like it.
  40.  
  41. Thanks to the many people who have mailed to say thanks and added
  42. ideas to xcal. Sorry to the people who I refused to listen to or whose
  43. ideas I haven't used.
  44.  
  45.  
  46. Patch-To: xcal: Volume 10, Issue 99-101
  47.  
  48. ------------------------- patch from here --------------
  49. Prereq: 0
  50. *** patchlevel.h~    Fri Mar 22 23:34:53 1991
  51. --- patchlevel.h    Fri Mar 22 23:48:23 1991
  52. ***************
  53. *** 1 ****
  54. ! #define PATCHLEVEL 0
  55. --- 1 ----
  56. ! #define PATCHLEVEL 1
  57. *** CHANGES~    Fri Mar 22 23:34:58 1991
  58. --- CHANGES    Fri Mar 22 23:48:26 1991
  59. ***************
  60. *** 1,6 ****
  61. ! Changes:    CHANGES    2.2    12/5/90
  62.   
  63. ! Xcal - Version 3.1 Issued to comp.sources.x
  64.   
  65.       Adds the memo functionality and the Stick/Unpin feature
  66.       for alarms.
  67. --- 1,69 ----
  68. ! Changes:      CHANGES     2.12     91/03/22
  69.   
  70. ! --------------------------- 3.3
  71. !     Implement the ability to deal with regular weekly events.
  72. !     This is part of the memo system. Today's current events are
  73. !     shown as part of the memo panel. They can be edited by hitting
  74. !     a button and bringing up a special strip with an entry for
  75. !     each day. These regular event files are integrated into
  76. !     the alarm system.
  77. !     Allow today's name: Monday, Tuesday etc to appear in the top
  78. !     level widget, the header of an edit window and the title of
  79. !     the memo box. This is controlled by the Order and Format
  80. !     resources and so previous behaviour can be maintained. Beware
  81. !     that this redefines the names of the days so
  82. !         Sunday maps to Sunday
  83. !     and a new short name is used for the abbreviated form
  84. !         Sun maps to Sun
  85. !     used in date strips.
  86. !     Ensure that middle and right button translations work in the
  87. !     memo button in the top level widget (suggested by Casey
  88. !     Leedom).
  89. !     New Imakefile from Casey Leedom. This has support for pscal.
  90. !     New pscal/Imakefile.
  91. !     Add initialMemo resource so the memo box can popup at startup
  92. !     time - (suggested by G. W. Pigman III)
  93. !     Steven Plite pointed out that the year display is
  94. !     inconsistent. To allow choice, add three new resources:
  95. !         dateYearIsTwoDigits
  96. !         memoYearIsTwoDigits
  97. !         editYearIsTwoDigits
  98. !     You can now choose how you would like to have your year
  99. !     displayed in the various places.
  100. !     Defaults to showing four digits.
  101. !     System V release 4 fixes from Dave McCraken.
  102. !     Alters: xcal_alarm.c, xcal_cal.c, *.bm xcal.c
  103. !     The memo box quit button causes a Save File
  104. !     dialogue box to be popped if the memo data has been
  105. !     altered and not saved. The behaviour of this was wrong
  106. !     when there was no memo data.    Reported by Greg Bond.
  107. !     Fixed by changing tests in xcal_memo.c.
  108. !     Proper length of a directory entry under SYSV is 
  109. !     strlen(dp->d_name) not strlen(dp->d_name)+1.
  110. !     Changed xcal_edit.c             (Dave McCraken)
  111. !     Eliminated double definition of GetMemoFile() and incorrect
  112. !     definition of MemoHelp() in xcal_memo.c (David C Lawrence)
  113. ! --------------------------- 3.2 
  114. ! Xcal - Version 3.2 Issued to comp.sources.x
  115. !     Fixes some stupid bugs
  116. !     Ensures that update code works properly
  117. ! ---------------------------- 3.1
  118. ! Xcal - Version 3.1 Issued to comp.sources.x (un-intentionally)
  119.   
  120.       Adds the memo functionality and the Stick/Unpin feature
  121.       for alarms.
  122. *** README~    Fri Mar 22 23:34:53 1991
  123. --- README    Fri Mar 22 23:48:23 1991
  124. ***************
  125. *** 26,37 ****
  126.   program. So you can generate pretty printed calendars whenever you
  127.   like - assuming that you have a PostScript printer.
  128.   
  129. ! This is release 3.2.
  130.   The history is:
  131.       Release 1.1  posted to comp.sources.x
  132.           + two patches
  133.       Release 2.1  circulated privately
  134. !     Release 3.1  circulated privately
  135.   
  136.   Caveats
  137.   
  138. --- 26,38 ----
  139.   program. So you can generate pretty printed calendars whenever you
  140.   like - assuming that you have a PostScript printer.
  141.   
  142. ! This is release 3.3
  143.   The history is:
  144.       Release 1.1  posted to comp.sources.x
  145.           + two patches
  146.       Release 2.1  circulated privately
  147. !     Release 3.1  posted unintentionally to comp.sources.x
  148. !     Release 3.2  posted to comp.sources.x
  149.   
  150.   Caveats
  151.   
  152. ***************
  153. *** 48,54 ****
  154.   Fax: +44 227 762554
  155.   Email: pc@hillside.co.uk
  156.   
  157. ! 18/December/1990
  158.   
  159.   Fixes/enhancements welcomed....
  160.   
  161. --- 49,55 ----
  162.   Fax: +44 227 762554
  163.   Email: pc@hillside.co.uk
  164.   
  165. ! 22/March/1990
  166.   
  167.   Fixes/enhancements welcomed....
  168.   
  169. *** Imakefile~    Fri Mar 22 23:34:48 1991
  170. --- Imakefile    Fri Mar 22 23:48:20 1991
  171. ***************
  172. *** 1,22 ****
  173. ! LOCAL_LIBRARIES = XawClientLibs
  174. !            INCS = xcal.h
  175. !            SRCS = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c version.c
  176. !            OBJS = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o version.o
  177.    OSMAJORVERSION = OSMajorVersion
  178.    OSMINORVERSION = OSMinorVersion
  179. !       DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) -DVER_VEC
  180.   
  181.   
  182. ! AllTarget(xcal)
  183. ! NormalProgramTarget(xcal,$(OBJS),$(DEPLIBS),$(LOCAL_LIBRARIES), /**/)
  184.   
  185. ! AllTarget(xcal_cal)
  186. ! NormalProgramTarget(xcal_cal, xcal_cal.o,/**/,/**/,/**/);
  187.   
  188. ! InstallProgram(xcal, $(BINDIR))
  189. ! InstallManPage(xcal, $(MANDIR))
  190. ! InstallProgram(xcal_cal, $(BINDIR))
  191. ! InstallManPage(xcal_cal, $(MANDIR))
  192.   InstallAppDefaults(XCal)
  193.   
  194. ! DependTarget()
  195. --- 1,35 ----
  196. ! /*
  197. !  * Define InstallPsCal if you want to have pscal compiled and installed as
  198. !  * part of the xcal compilation and installation.
  199. !  */
  200. ! /* #define InstallPsCal */
  201.    OSMAJORVERSION = OSMajorVersion
  202.    OSMINORVERSION = OSMinorVersion
  203. !         DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \
  204. !           -DOSMINORVERSION=$(OSMINORVERSION) \
  205. !           -DVER_VEC
  206.   
  207. +           SRCS1 = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c \
  208. +           xcal_strip.c xcal_memo.c version.c
  209. +           OBJS1 = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o \
  210. +           xcal_strip.o xcal_memo.o version.o
  211.   
  212. !           SRCS2 = xcal_cal.c
  213. !           OBJS2 = xcal_cal.o
  214.   
  215. !        PROGRAMS = xcal xcal_cal
  216.   
  217. ! ComplexProgramTarget_1(xcal, XawClientLibs, /**/)
  218. ! ComplexProgramTarget_2(xcal_cal, /**/, /**/)
  219.   InstallAppDefaults(XCal)
  220.   
  221. ! #ifdef InstallPsCal
  222. ! #define IHaveSubdirs
  223. ! #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  224. !         SUBDIRS = pscal
  225. ! MakeSubdirs($(SUBDIRS))
  226. ! DependSubdirs($(SUBDIRS))
  227. ! #endif
  228. *** Makefile~    Fri Mar 22 23:34:55 1991
  229. --- Makefile    Fri Mar 22 23:48:24 1991
  230. ***************
  231. *** 225,273 ****
  232.   ###########################################################################
  233.   # start of Imakefile
  234.   
  235. - LOCAL_LIBRARIES = $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB)
  236. -            INCS = xcal.h
  237. -            SRCS = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c xcal_strip.c xcal_memo.c version.c
  238. -            OBJS = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o xcal_strip.o xcal_memo.o version.o
  239.    OSMAJORVERSION = 4
  240.    OSMINORVERSION = 1
  241. !       DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) -DVER_VEC
  242.   
  243. ! all:: xcal
  244.   
  245. ! xcal: $(OBJS) $(DEPLIBS)
  246. !     $(RM) $@
  247. !     $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
  248.   
  249. ! clean::
  250. !     $(RM) xcal
  251.   
  252. ! all:: xcal_cal
  253.   
  254. ! xcal_cal:  xcal_cal.o
  255.       $(RM) $@
  256. !     $(CC) -o $@  xcal_cal.o $(LDOPTIONS)  $(LDLIBS)  $(EXTRA_LOAD_FLAGS)
  257.   
  258. - clean::
  259. -     $(RM) xcal_cal;
  260.   install:: xcal
  261. !     $(INSTALL) -c $(INSTPGMFLAGS)   xcal  $(BINDIR)
  262.   
  263.   install.man:: xcal.man
  264. !     $(INSTALL) -c $(INSTMANFLAGS) xcal.man  $(MANDIR)/xcal.n
  265.   
  266.   install:: xcal_cal
  267. !     $(INSTALL) -c $(INSTPGMFLAGS)   xcal_cal  $(BINDIR)
  268.   
  269.   install.man:: xcal_cal.man
  270. !     $(INSTALL) -c $(INSTMANFLAGS) xcal_cal.man  $(MANDIR)/xcal_cal.n
  271.   
  272.   install:: XCal.ad
  273.       $(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(XAPPLOADDIR)/XCal
  274. - depend::
  275. -     $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  276.   
  277.   ###########################################################################
  278.   # common rules for all Makefiles - do not edit
  279. --- 225,284 ----
  280.   ###########################################################################
  281.   # start of Imakefile
  282.   
  283.    OSMAJORVERSION = 4
  284.    OSMINORVERSION = 1
  285. !         DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \
  286. !           -DOSMINORVERSION=$(OSMINORVERSION) \
  287. !           -DVER_VEC
  288.   
  289. !           SRCS1 = xcal.c xcal_alarm.c xcal_edit.c xcal_help.c xcal_popup.c \
  290. !           xcal_strip.c xcal_memo.c version.c
  291. !           OBJS1 = xcal.o xcal_alarm.o xcal_edit.o xcal_help.o xcal_popup.o \
  292. !           xcal_strip.o xcal_memo.o version.o
  293.   
  294. !           SRCS2 = xcal_cal.c
  295. !           OBJS2 = xcal_cal.o
  296.   
  297. !        PROGRAMS = xcal xcal_cal
  298.   
  299. !  OBJS = $(OBJS1) $(OBJS2) $(OBJS3)
  300. !  SRCS = $(SRCS1) $(SRCS2) $(SRCS3)
  301.   
  302. ! all:: $(PROGRAMS)
  303. ! xcal: $(OBJS1) $(DEPLIBS1)
  304.       $(RM) $@
  305. !     $(CC) -o $@ $(LDOPTIONS) $(OBJS1)  $(XAWLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
  306.   
  307.   install:: xcal
  308. !     $(INSTALL) -c $(INSTPGMFLAGS)   xcal $(BINDIR)
  309.   
  310.   install.man:: xcal.man
  311. !     $(INSTALL) -c $(INSTMANFLAGS) xcal.man $(MANDIR)/xcal.n
  312.   
  313. + depend::
  314. +     $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  315. + lint:
  316. +     $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS)
  317. + lint1:
  318. +     $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  319. + clean::
  320. +     $(RM) $(PROGRAMS)
  321. + xcal_cal: $(OBJS2) $(DEPLIBS2)
  322. +     $(RM) $@
  323. +     $(CC) -o $@ $(LDOPTIONS) $(OBJS2)   $(LDLIBS)   $(EXTRA_LOAD_FLAGS)
  324.   install:: xcal_cal
  325. !     $(INSTALL) -c $(INSTPGMFLAGS)   xcal_cal $(BINDIR)
  326.   
  327.   install.man:: xcal_cal.man
  328. !     $(INSTALL) -c $(INSTMANFLAGS) xcal_cal.man $(MANDIR)/xcal_cal.n
  329.   
  330.   install:: XCal.ad
  331.       $(INSTALL) -c $(INSTAPPFLAGS) XCal.ad $(XAPPLOADDIR)/XCal
  332.   
  333.   ###########################################################################
  334.   # common rules for all Makefiles - do not edit
  335. *** XCal.ad~    Fri Mar 22 23:34:51 1991
  336. --- XCal.ad    Fri Mar 22 23:48:21 1991
  337. ***************
  338. *** 1,8 ****
  339.   XCal.MarkForeground: Black
  340.   XCal.MarkBackground: White
  341. ! XCal.edit.geometry: 300x150
  342. ! XCal.memo.geometry: 300x300
  343. ! XCal.alarm.geometry: 300x100+0+150
  344.   XCal*help.geometry: 600x300
  345.   XCal.fontToday: lucidasanstypewriter-12
  346.   XCal*Font: lucidasanstypewriter-12
  347. --- 1,8 ----
  348.   XCal.MarkForeground: Black
  349.   XCal.MarkBackground: White
  350. ! XCal.edit.geometry: 325x150
  351. ! XCal.memo.geometry: 325x300
  352. ! XCal.alarm.geometry: 325x100+0+150
  353.   XCal*help.geometry: 600x300
  354.   XCal.fontToday: lucidasanstypewriter-12
  355.   XCal*Font: lucidasanstypewriter-12
  356. ***************
  357. *** 40,45 ****
  358. --- 40,48 ----
  359.   XCal*alarmQuit.Label: Unpin
  360.   XCal*alarmHold.Label: Stick
  361.   XCal*memoTitle.Label: Edit the memo file
  362. + XCal*weeklyEdit.Label: Edit
  363. + XCal*weeklyTitle.Label: Today's regular events
  364.   !
  365.   ! Colours from reed wade@cs.utk.edu
  366.   !
  367. *** mouse.bm~    Fri Mar 22 23:34:58 1991
  368. --- mouse.bm    Fri Mar 22 23:48:26 1991
  369. ***************
  370. *** 1,6 ****
  371.   #define mouse_width 16
  372.   #define mouse_height 13
  373. ! static char mouse_bits[] = {
  374.      0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5,
  375.      0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
  376.      0xff, 0xff};
  377. --- 1,6 ----
  378.   #define mouse_width 16
  379.   #define mouse_height 13
  380. ! static unsigned char mouse_bits[] = {
  381.      0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5,
  382.      0xa1, 0xb5, 0xa1, 0xb5, 0xa1, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
  383.      0xff, 0xff};
  384. *** mouseaway.bm~    Fri Mar 22 23:34:58 1991
  385. --- mouseaway.bm    Fri Mar 22 23:48:26 1991
  386. ***************
  387. *** 1,6 ****
  388.   #define mouseaway_width 16
  389.   #define mouseaway_height 13
  390. ! static char mouseaway_bits[] = {
  391.      0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5,
  392.      0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
  393.      0xff, 0xff};
  394. --- 1,6 ----
  395.   #define mouseaway_width 16
  396.   #define mouseaway_height 13
  397. ! static unsigned char mouseaway_bits[] = {
  398.      0xfe, 0x7f, 0xff, 0xff, 0x21, 0x84, 0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5,
  399.      0xad, 0xb5, 0xad, 0xb5, 0xad, 0xb5, 0x21, 0x84, 0xff, 0xff, 0xff, 0xff,
  400.      0xff, 0xff};
  401. *** version.c~    Fri Mar 22 23:34:48 1991
  402. --- version.c    Fri Mar 22 23:48:20 1991
  403. ***************
  404. *** 1,10 ****
  405.   #ifndef lint
  406. ! static char *sccsid = "@(#)version.c    3.2 (Hillside Systems) 12/18/90";
  407.   #endif  /* lint */
  408.   /*
  409.    *    Version control file
  410. !  *    version.c    3.2    12/18/90
  411. !  *    Automatically created on Tue Dec 18 21:15:55 GMT 1990
  412.    *    
  413.    *    Hand edit none of this if you want freeze to continue to work
  414.    */
  415. --- 1,10 ----
  416.   #ifndef lint
  417. ! static char *sccsid = "@(#)version.c    3.3 (Hillside Systems) 3/22/91";
  418.   #endif  /* lint */
  419.   /*
  420.    *    Version control file
  421. !  *    version.c    3.3    3/22/91
  422. !  *    Automatically created on Fri Mar 22 23:48:16 GMT 1991
  423.    *    
  424.    *    Hand edit none of this if you want freeze to continue to work
  425.    */
  426. ***************
  427. *** 12,43 ****
  428.   #define    PROGNAME    XCal
  429.   #endif
  430.   #ifdef    VER_VEC
  431. ! char    version[] = "XCal Version 3.2, released Tue Dec 18 21:15:55 GMT 1990";
  432.   #endif
  433.   #ifdef    VER_DEF
  434. ! #define    VERSION    "XCal Version 3.2, released Tue Dec 18 21:15:55 GMT 1990"
  435.   #endif
  436.   
  437.   /*    SCCS files
  438.    *
  439. ! +1.7    Imakefile
  440. ! +3.5    xcal_help.c
  441. ! +1.4    xcal_cal.c
  442. ! +1.12    xcal.man
  443. ! +1.5    xcal_memo.c
  444. ! +1.10    XCal.ad
  445. ! +1.10    xcal_alarm.c
  446. ! +3.9    xcal_edit.c
  447. ! +1.4    README
  448. ! +2.1    patchlevel.h
  449. ! +3.6    xcal_strip.c
  450.   +1.2    xcal_cal.man
  451. ! +1.8    Makefile
  452. ! +3.4    xcal_popup.c
  453. ! +3.13    xcal.c
  454. ! +3.8    xcal.h
  455. ! +2.2    CHANGES
  456. ! +1.1    mouse.bm
  457. ! +1.1    mouseaway.bm
  458.    *
  459.    */
  460. --- 12,43 ----
  461.   #define    PROGNAME    XCal
  462.   #endif
  463.   #ifdef    VER_VEC
  464. ! char    version[] = "XCal Version 3.3, released Fri Mar 22 23:48:16 GMT 1991";
  465.   #endif
  466.   #ifdef    VER_DEF
  467. ! #define    VERSION    "XCal Version 3.3, released Fri Mar 22 23:48:16 GMT 1991"
  468.   #endif
  469.   
  470.   /*    SCCS files
  471.    *
  472. ! +1.9    Imakefile
  473. ! +3.6    xcal_help.c
  474. ! +1.6    xcal_cal.c
  475. ! +1.17    xcal.man
  476. ! +1.11    xcal_memo.c
  477. ! +1.13    XCal.ad
  478. ! +1.13    xcal_alarm.c
  479. ! +3.15    xcal_edit.c
  480. ! +1.6    README
  481. ! +2.2    patchlevel.h
  482. ! +3.10    xcal_strip.c
  483.   +1.2    xcal_cal.man
  484. ! +1.10    Makefile
  485. ! +3.5    xcal_popup.c
  486. ! +3.22    xcal.c
  487. ! +3.14    xcal.h
  488. ! +2.12    CHANGES
  489. ! +1.2    mouse.bm
  490. ! +1.2    mouseaway.bm
  491.    *
  492.    */
  493. *** xcal.c~    Fri Mar 22 23:34:56 1991
  494. --- xcal.c    Fri Mar 22 23:48:25 1991
  495. ***************
  496. *** 1,5 ****
  497.   #ifndef lint
  498. ! static char *sccsid = "@(#)xcal.c    3.13 (Hillside Systems) 12/7/90";
  499.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  500.   #endif  /* lint */
  501.   /***
  502. --- 1,5 ----
  503.   #ifndef lint
  504. ! static char *sccsid = "@(#)xcal.c    3.22 (Hillside Systems) 1/16/91";
  505.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  506.   #endif  /* lint */
  507.   /***
  508. ***************
  509. *** 13,18 ****
  510. --- 13,19 ----
  511.       -format str    use str as a display format
  512.       -order    ord    set the argument order to this
  513.       -debug        run quickly incrementing time - 1 day per sec
  514. +     -alarmscan    print alarm debug info
  515.   * libraries used:
  516.       libXaw.a, libXmu.a libXt.a libX11.a
  517.   * compile time parameters:
  518. ***************
  519. *** 91,96 ****
  520. --- 92,99 ----
  521.       offset(initialCalendar), XtRString, "False" },
  522.   {"initialEdit", "InitialEdit", XtRBoolean, sizeof(Boolean),
  523.       offset(initialEdit), XtRString, "False" },
  524. + {"initialMemo", "InitialMemo", XtRBoolean, sizeof(Boolean),
  525. +     offset(initialMemo), XtRString, "False" },
  526.   {"markForeground", "MarkForeground", XtRPixel, sizeof(Pixel),
  527.       offset(marked.fg), XtRString, "White" },
  528.   {"markBackground", "MarkBackground", XtRPixel, sizeof(Pixel),
  529. ***************
  530. *** 104,112 ****
  531.   {"todayBackground", "TodayBackground", XtRPixel, sizeof(Pixel),
  532.       offset(today.bg), XtRString, "Black" },
  533.   {"format", "Format",XtRString, sizeof(String),
  534. !     offset(opfmt), XtRString, "%2d %s %d"},
  535.   {"order", "Order", XtRString, sizeof(String),
  536. !     offset(order), XtRString, "dmy"},
  537.   {"directory", "Directory", XtRString, sizeof(String),
  538.       offset(directory), XtRString, "Calendar"},
  539.   {"textBufferSize", "TextBufferSize", XtRInt, sizeof(int),
  540. --- 107,121 ----
  541.   {"todayBackground", "TodayBackground", XtRPixel, sizeof(Pixel),
  542.       offset(today.bg), XtRString, "Black" },
  543.   {"format", "Format",XtRString, sizeof(String),
  544. !     offset(opfmt), XtRString, "%s %2d %s %d"},
  545.   {"order", "Order", XtRString, sizeof(String),
  546. !     offset(order), XtRString, "wdmy"},
  547. ! {"dateYearIsTwoDigits", "DateYearIsTwoDigits", XtRBoolean, sizeof(Boolean),
  548. !     offset(dateYearIs2), XtRString, "False" },
  549. ! {"editYearIsTwoDigits", "EditYearIsTwoDigits", XtRBoolean, sizeof(Boolean),
  550. !     offset(editYearIs2), XtRString, "False" },
  551. ! {"memoYearIsTwoDigits", "MemoYearIsTwoDigits", XtRBoolean, sizeof(Boolean),
  552. !     offset(memoYearIs2), XtRString, "False" },
  553.   {"directory", "Directory", XtRString, sizeof(String),
  554.       offset(directory), XtRString, "Calendar"},
  555.   {"textBufferSize", "TextBufferSize", XtRInt, sizeof(int),
  556. ***************
  557. *** 164,182 ****
  558.   {"dec", "Dec", XtRString, sizeof(String),
  559.       offset(smon[11]), XtRString, "Dec"},
  560.   {"sunday", "Sunday", XtRString, sizeof(String),
  561. !     offset(day[0]), XtRString, "Sun"},
  562.   {"monday", "Monday", XtRString, sizeof(String),
  563. !     offset(day[1]), XtRString, "Mon"},
  564.   {"tuesday", "Tuesday", XtRString, sizeof(String),
  565. !     offset(day[2]), XtRString, "Tue"},
  566.   {"wednesday", "Wednesday", XtRString, sizeof(String),
  567. !     offset(day[3]), XtRString, "Wed"},
  568.   {"thursday", "Thursday", XtRString, sizeof(String),
  569. !     offset(day[4]), XtRString, "Thu"},
  570.   {"friday", "Friday", XtRString, sizeof(String),
  571. !     offset(day[5]), XtRString, "Fri"},
  572.   {"saturday", "Saturday", XtRString, sizeof(String),
  573. !     offset(day[6]), XtRString, "Sat"},
  574.   {"alarms", "Alarms", XtRBoolean, sizeof(Boolean),
  575.       offset(alarms), XtRString, "True"},
  576.   {"update", "Update", XtRInt, sizeof(int),
  577. --- 173,207 ----
  578.   {"dec", "Dec", XtRString, sizeof(String),
  579.       offset(smon[11]), XtRString, "Dec"},
  580.   {"sunday", "Sunday", XtRString, sizeof(String),
  581. !     offset(day[0]), XtRString, "Sunday"},
  582.   {"monday", "Monday", XtRString, sizeof(String),
  583. !     offset(day[1]), XtRString, "Monday"},
  584.   {"tuesday", "Tuesday", XtRString, sizeof(String),
  585. !     offset(day[2]), XtRString, "Tuesday"},
  586.   {"wednesday", "Wednesday", XtRString, sizeof(String),
  587. !     offset(day[3]), XtRString, "Wednesday"},
  588.   {"thursday", "Thursday", XtRString, sizeof(String),
  589. !     offset(day[4]), XtRString, "Thursday"},
  590.   {"friday", "Friday", XtRString, sizeof(String),
  591. !     offset(day[5]), XtRString, "Friday"},
  592.   {"saturday", "Saturday", XtRString, sizeof(String),
  593. !     offset(day[6]), XtRString, "Saturday"},
  594. ! {"sun", "Sun", XtRString, sizeof(String),
  595. !     offset(sday[0]), XtRString, "Sun"},
  596. ! {"mon", "Mon", XtRString, sizeof(String),
  597. !     offset(sday[1]), XtRString, "Mon"},
  598. ! {"tue", "Tue", XtRString, sizeof(String),
  599. !     offset(sday[2]), XtRString, "Tue"},
  600. ! {"wed", "Wed", XtRString, sizeof(String),
  601. !     offset(sday[3]), XtRString, "Wed"},
  602. ! {"thu", "Thu", XtRString, sizeof(String),
  603. !     offset(sday[4]), XtRString, "Thu"},
  604. ! {"fri", "Fri", XtRString, sizeof(String),
  605. !     offset(sday[5]), XtRString, "Fri"},
  606. ! {"sat", "Sat", XtRString, sizeof(String),
  607. !     offset(sday[6]), XtRString, "Sat"},
  608. ! {"weekly", "Weekly", XtRString, sizeof(String),
  609. !     offset(weekly), XtRString, "Weekly"},
  610.   {"alarms", "Alarms", XtRBoolean, sizeof(Boolean),
  611.       offset(alarms), XtRString, "True"},
  612.   {"update", "Update", XtRInt, sizeof(int),
  613. ***************
  614. *** 231,240 ****
  615.   /*
  616.    *    Forward routines local to this file
  617.    */
  618. ! void    MkDate();
  619. ! void    DebugMkDate();
  620. ! void    DoTemplate();
  621. ! void    DecodeOrder();
  622.   #include "mouse.bm"
  623.   #include "mouseaway.bm"
  624.   
  625. --- 256,267 ----
  626.   /*
  627.    *    Forward routines local to this file
  628.    */
  629. ! static void    MkDate();
  630. ! static void    DebugMkDate();
  631. ! static void    DoTemplate();
  632. ! static void    DecodeOrder();
  633. ! static void    PixInit();
  634.   #include "mouse.bm"
  635.   #include "mouseaway.bm"
  636.   
  637. ***************
  638. *** 362,367 ****
  639. --- 389,396 ----
  640.       }
  641.       XtAddActions(appActions, 3);    /* register actions */
  642.       XtAugmentTranslations(lab, XtParseTranslationTable(defTranslations));
  643. +     if (appResources.useMemo)
  644. +         XtAugmentTranslations(memo, XtParseTranslationTable(defTranslations));
  645.   
  646.       XtMapWidget(toplevel);
  647.   
  648. ***************
  649. *** 377,390 ****
  650. --- 406,424 ----
  651.               StartEditing(lab, &today);
  652.       }
  653.   
  654. +     if (appResources.useMemo && appResources.initialMemo)
  655. +         DoMemo(memo, NULL, NULL);
  656. +         
  657.       InitAlarms();
  658.       
  659.       XtMainLoop();
  660. +     exit(0);
  661.   }
  662.   
  663.   /*
  664.    *    Initialise Pixmaps
  665.    */
  666. + static void
  667.   PixInit(toplevel)
  668.       Widget    toplevel;
  669.   {
  670. ***************
  671. *** 392,406 ****
  672.   
  673.       MouseOnPix = XCreateBitmapFromData(theDisplay,
  674.                     DefaultRootWindow(theDisplay),
  675. !                   mouse_bits, mouse_width, mouse_height);
  676.       MouseOffPix = XCreateBitmapFromData(theDisplay,
  677.                     DefaultRootWindow(theDisplay),
  678. !                   mouseaway_bits, mouseaway_width, mouseaway_height);
  679.   }
  680.   
  681.   /*
  682.    *    Flip mouse state
  683.    */
  684.   MouseShow(w, OnOff)
  685.       Widget    w;
  686.       Boolean OnOff;
  687. --- 426,441 ----
  688.   
  689.       MouseOnPix = XCreateBitmapFromData(theDisplay,
  690.                     DefaultRootWindow(theDisplay),
  691. !                   (char *)mouse_bits, mouse_width, mouse_height);
  692.       MouseOffPix = XCreateBitmapFromData(theDisplay,
  693.                     DefaultRootWindow(theDisplay),
  694. !                   (char *)mouseaway_bits, mouseaway_width, mouseaway_height);
  695.   }
  696.   
  697.   /*
  698.    *    Flip mouse state
  699.    */
  700. + void
  701.   MouseShow(w, OnOff)
  702.       Widget    w;
  703.       Boolean OnOff;
  704. ***************
  705. *** 417,422 ****
  706. --- 452,458 ----
  707.    */
  708.   void
  709.   Leave(retval)
  710. +     int retval;
  711.   {    exit(retval);
  712.   }
  713.   
  714. ***************
  715. *** 440,445 ****
  716. --- 476,482 ----
  717.       dp->day = tm->tm_mday;
  718.       dp->month = tm->tm_mon;
  719.       dp->year = tm->tm_year + 1900;
  720. +     dp->wday = tm->tm_wday;
  721.   }
  722.   
  723.   
  724. ***************
  725. *** 454,466 ****
  726.       if (timedOut)
  727.           yesterday = today;
  728.           
  729. !     ti = time(0);
  730.       tm = localtime(&ti);
  731.   
  732.       ConvDate(tm, &today);
  733.   
  734. !     PlaceStr(date_area,
  735. !             tm->tm_mday, appResources.mon[tm->tm_mon], tm->tm_year);
  736.       XtSetValues(w, wargs, 1);
  737.   
  738.       if (timedOut)
  739. --- 491,503 ----
  740.       if (timedOut)
  741.           yesterday = today;
  742.           
  743. !     (void) time(&ti);
  744.       tm = localtime(&ti);
  745.   
  746.       ConvDate(tm, &today);
  747.   
  748. !     PlaceStr(date_area, &today, appResources.dateYearIs2);
  749.       XtSetValues(w, wargs, 1);
  750.   
  751.       if (timedOut)
  752. ***************
  753. *** 486,499 ****
  754.           yesterday = today;
  755.           
  756.       if (ti == 0)
  757. !         ti = time(0);
  758.       else    ti += 24*60*60;
  759.       
  760.       tm = localtime(&ti);
  761.       ConvDate(tm, &today);
  762.       
  763. !     PlaceStr(date_area,
  764. !           tm->tm_mday, appResources.mon[tm->tm_mon], tm->tm_year);
  765.       XtSetValues(w, wargs, 1);
  766.   
  767.       if (timedOut)
  768. --- 523,536 ----
  769.           yesterday = today;
  770.           
  771.       if (ti == 0)
  772. !         (void) time(&ti);
  773.       else    ti += 24*60*60;
  774.       
  775.       tm = localtime(&ti);
  776.       ConvDate(tm, &today);
  777.       
  778. !     PlaceStr(date_area, &today, appResources.dateYearIs2);
  779.       XtSetValues(w, wargs, 1);
  780.   
  781.       if (timedOut)
  782. ***************
  783. *** 513,529 ****
  784.    */
  785.   static void
  786.   DoTemplate()
  787. ! {    int    maxmon;
  788.       int    i;
  789.       int    len;
  790.       char    trial[BUFSIZ];
  791.   
  792.   
  793. !     for (maxmon = i = 0; i < 12; i++)
  794. !     {    PlaceStr(trial, 99, appResources.mon[i], 99);
  795.           len = strlen(trial);
  796. !         if (len > maxmon)
  797. !         {    maxmon = len;
  798.               strcpy(date_area, trial);
  799.           }
  800.       }
  801. --- 550,578 ----
  802.    */
  803.   static void
  804.   DoTemplate()
  805. ! {    int    max;
  806.       int    i;
  807.       int    len;
  808.       char    trial[BUFSIZ];
  809. +     Date    da;
  810.   
  811. +     da.day = 99;
  812. +     da.year = 9999;
  813.   
  814. !     for (da.wday = max = i = 0; i < 7; i++)
  815. !     {    len = strlen(appResources.day[i]);
  816. !         if (len > max)
  817. !         {    max = len;
  818. !             da.wday = i;
  819. !         }
  820. !     }
  821. !     for (max = i = 0; i < 12; i++)
  822. !     {    da.month = i;
  823. !         PlaceStr(trial, &da, appResources.dateYearIs2);
  824.           len = strlen(trial);
  825. !         if (len > max)
  826. !         {    max = len;
  827.               strcpy(date_area, trial);
  828.           }
  829.       }
  830. ***************
  831. *** 536,565 ****
  832.   DecodeOrder()
  833.   {
  834.       register char    *p;
  835.       p = appResources.order;
  836.   
  837. !     if (*p == 'd' && strcmp(p, "dmy") == 0)
  838. !         appResources.val_order = O_DMY;
  839.       else
  840.       if (*p == 'y')
  841. !     {    if (strcmp(p, "ymd") == 0)
  842. !             appResources.val_order = O_YMD;
  843.           else
  844. !         if (strcmp(p, "ydm") == 0)
  845. !             appResources.val_order = O_YDM;
  846.           else
  847. !             appResources.val_order = -1;
  848.       }
  849.       else
  850. !     if (*p == 'm' && strcmp(p, "mdy") == 0)
  851. !         appResources.val_order = O_MDY;
  852.       else
  853. !         appResources.val_order = -1;
  854. !     if (appResources.val_order == -1)
  855.       {    fprintf(stderr, "Unknown order: %s\n", p);
  856. !         appResources.val_order = O_DMY;
  857.       }
  858.   }
  859.               
  860.   /*
  861. --- 585,626 ----
  862.   DecodeOrder()
  863.   {
  864.       register char    *p;
  865. !     int    order = 0;
  866. !     int    addweekday = 0;
  867. !     
  868.       p = appResources.order;
  869.   
  870. !     if (*p == 'w')
  871. !     {    addweekday = O_WEEKLEFT;
  872. !         p++;
  873. !     }
  874. !     
  875. !     if (*p == 'd' && strncmp(p, "dmy", 3) == 0)
  876. !         order = O_DMY;
  877.       else
  878.       if (*p == 'y')
  879. !     {    if (strncmp(p, "ymd", 3) == 0)
  880. !             order = O_YMD;
  881.           else
  882. !         if (strncmp(p, "ydm", 3) == 0)
  883. !             order = O_YDM;
  884.           else
  885. !             order = -1;
  886.       }
  887.       else
  888. !     if (*p == 'm' && strncmp(p, "mdy", 3) == 0)
  889. !         order = O_MDY;
  890.       else
  891. !         order = -1;
  892. !     if (order == -1)
  893.       {    fprintf(stderr, "Unknown order: %s\n", p);
  894. !         order = O_DMY;
  895.       }
  896. +     if (addweekday == 0 && p[3] == 'w')
  897. +         addweekday = O_WEEKRIGHT;
  898. +     appResources.val_order = order | addweekday;
  899.   }
  900.               
  901.   /*
  902. ***************
  903. *** 566,581 ****
  904.    *    make a string
  905.    */
  906.   void
  907. ! PlaceStr(dest, d, m, y)
  908.       String    dest;
  909. !     int    d;
  910. !     String    m;
  911. !     int    y;
  912.   {
  913.       register String fmt;
  914.   
  915.       if (y > 99 && y < 1900)
  916.           y -= 100;
  917.           
  918.       fmt = appResources.opfmt;
  919.       
  920. --- 627,648 ----
  921.    *    make a string
  922.    */
  923.   void
  924. ! PlaceStr(dest, da, is2)
  925.       String    dest;
  926. !     Date    *da;
  927. !     Boolean is2;
  928.   {
  929.       register String fmt;
  930. +     int    d = da->day;
  931. +     String    m = appResources.mon[da->month];
  932. +     int    y = da->year;
  933. +     String    w = appResources.day[da->wday];
  934.   
  935.       if (y > 99 && y < 1900)
  936.           y -= 100;
  937. +     if (is2)
  938. +         y %= 100;
  939.           
  940.       fmt = appResources.opfmt;
  941.       
  942. ***************
  943. *** 584,597 ****
  944. --- 651,688 ----
  945.       case O_DMY:        /* default */
  946.           (void) sprintf(dest, fmt, d, m, y);
  947.           break;
  948. +     case O_DMY|O_WEEKLEFT:
  949. +         (void) sprintf(dest, fmt, w, d, m, y);
  950. +         break;
  951. +     case O_DMY|O_WEEKRIGHT:
  952. +         (void) sprintf(dest, fmt, d, m, y, w);
  953. +         break;
  954.       case O_YMD:        /* Year/Month/Day */
  955.           (void) sprintf(dest, fmt, y, m, d);
  956.           break;
  957. +     case O_YMD|O_WEEKLEFT:    /* Year/Month/Day */
  958. +         (void) sprintf(dest, fmt, w, y, m, d);
  959. +         break;
  960. +     case O_YMD|O_WEEKRIGHT:    /* Year/Month/Day */
  961. +         (void) sprintf(dest, fmt, y, m, d, w);
  962. +         break;
  963.       case O_MDY:        /* Month/Day/Year */
  964.           (void) sprintf(dest, fmt, m, d, y);
  965.           break;
  966. +     case O_MDY|O_WEEKLEFT:    /* Month/Day/Year */
  967. +         (void) sprintf(dest, fmt, w, m, d, y);
  968. +         break;
  969. +     case O_MDY|O_WEEKRIGHT:    /* Month/Day/Year */
  970. +         (void) sprintf(dest, fmt, m, d, y, w);
  971. +         break;
  972.       case O_YDM:        /* Year/Day/Month */
  973.           (void) sprintf(dest, fmt, y, d, m);
  974. +         break;
  975. +     case O_YDM|O_WEEKLEFT:    /* Year/Day/Month */
  976. +         (void) sprintf(dest, fmt, w, y, d, m);
  977. +         break;
  978. +     case O_YDM|O_WEEKRIGHT:    /* Year/Day/Month */
  979. +         (void) sprintf(dest, fmt, y, d, m, w);
  980.           break;
  981.       }
  982.   }
  983. *** xcal.h~    Fri Mar 22 23:34:57 1991
  984. --- xcal.h    Fri Mar 22 23:48:25 1991
  985. ***************
  986. *** 1,5 ****
  987.   /*
  988. !  *    xcal.h    3.8    12/12/90
  989.    *
  990.    *    Header file for the xcal program
  991.    */
  992. --- 1,5 ----
  993.   /*
  994. !  *    xcal.h    3.14    1/16/91
  995.    *
  996.    *    Header file for the xcal program
  997.    */
  998. ***************
  999. *** 10,28 ****
  1000.    *    so undef if not true
  1001.    *    and fiddle with the definitions below
  1002.    */
  1003. ! #define    LONG_IS_32_BITS
  1004.   
  1005.   /* pack year and month into Cardinals */
  1006.   #ifdef LONG_IS_32_BITS
  1007. ! #define    DatePack(d, m, y)    ((((d)&0x1f)<<16) | (((m)&0xf)<<12) | ((y)&0xfff))
  1008.   #define YrUnpack(v)    ((v)&0xfff)
  1009.   #define MoUnpack(v)    (((v)>>12)&0xf)
  1010.   #define DyUnpack(v)    (((v)>>16)&0x1f)
  1011. ! #else  LONG_IS_32_BITS
  1012.   #define    DatePack(m, y)    ((((m)&0xf)<<12) | ((y)&0xfff))
  1013.   #define YrUnpack(v)    ((v)&0xfff)
  1014.   #define MoUnpack(v)    (((v)>>12)&0xf)
  1015. ! #endif  LONG_IS_32_BITS
  1016.   
  1017.   /*
  1018.    *    Foreground/Background colours
  1019. --- 10,32 ----
  1020.    *    so undef if not true
  1021.    *    and fiddle with the definitions below
  1022.    */
  1023. ! /* #define    LONG_IS_32_BITS */
  1024.   
  1025.   /* pack year and month into Cardinals */
  1026.   #ifdef LONG_IS_32_BITS
  1027. ! #define    DatePack(w, d, m, y)    ((((w)&0x7)<<21) | (((d)&0x1f)<<16) | (((m)&0xf)<<12) | ((y)&0xfff))
  1028.   #define YrUnpack(v)    ((v)&0xfff)
  1029.   #define MoUnpack(v)    (((v)>>12)&0xf)
  1030.   #define DyUnpack(v)    (((v)>>16)&0x1f)
  1031. ! #define WdUnpack(v)    (((v)>>21)&0x7)
  1032. ! #else /*  LONG_IS_32_BITS */
  1033.   #define    DatePack(m, y)    ((((m)&0xf)<<12) | ((y)&0xfff))
  1034. + #define DayPack(w, d)    ((((w)&0x7)<<5) | ((d)&0x1f))
  1035.   #define YrUnpack(v)    ((v)&0xfff)
  1036.   #define MoUnpack(v)    (((v)>>12)&0xf)
  1037. ! #define DyUnpack(v)    ((v)&0x1f)
  1038. ! #define WdUnpack(v)    (((v)>>5)&0xf)
  1039. ! #endif /* LONG_IS_32_BITS */
  1040.   
  1041.   /*
  1042.    *    Foreground/Background colours
  1043. ***************
  1044. *** 47,55 ****
  1045.       Boolean giveHelp;    /* True if help is needed (default) */
  1046.       Boolean initialCalendar;/* Pop up Calendar on startup if True */
  1047.       Boolean initialEdit;    /* Pop up today's Edit on startup if True */
  1048.       String    mon[12];    /* Long month names */
  1049.       String    smon[12];    /* Short month names */
  1050. !     String    day[7];        /* day names */
  1051.       String    opfmt;        /* format for main box */
  1052.       String    order;        /* Orders are dmy/ymd/mdy/ydm */
  1053.       int    val_order;    /* The selected order */
  1054. --- 51,65 ----
  1055.       Boolean giveHelp;    /* True if help is needed (default) */
  1056.       Boolean initialCalendar;/* Pop up Calendar on startup if True */
  1057.       Boolean initialEdit;    /* Pop up today's Edit on startup if True */
  1058. +     Boolean    initialMemo;    /* Pop up memo box on start */
  1059. +     Boolean    dateYearIs2;    /* Display year as two digits in date strip  */
  1060. +     Boolean    editYearIs2;    /* Display year as two digits in edit strip  */
  1061. +     Boolean    memoYearIs2;    /* Display year as two digits in memo strip  */
  1062.       String    mon[12];    /* Long month names */
  1063.       String    smon[12];    /* Short month names */
  1064. !     String    day[7];        /* Day names - full */
  1065. !     String    sday[7];    /* Short day names */
  1066. !     String    weekly;        /* Title of weekly edit strip */
  1067.       String    opfmt;        /* format for main box */
  1068.       String    order;        /* Orders are dmy/ymd/mdy/ydm */
  1069.       int    val_order;    /* The selected order */
  1070. ***************
  1071. *** 65,72 ****
  1072.       int    update;        /* interval between peeks (60 secs) */
  1073.       int    volume;        /* how loud to beep the alarm 0-100 */
  1074.       int    nbeeps;        /* how many beeps for an alarm ? */
  1075. -     long    last_size;    /* save the last time size */
  1076. -     long    last_time;    /* save the last time file accessed */
  1077.       int    autoquit;    /* Automatically delete message boxes */
  1078.       String    countdown;    /* Comma separated countdown string for alarms */
  1079.       String    cmd;        /* command to execute for every alarm */
  1080. --- 75,80 ----
  1081. ***************
  1082. *** 85,94 ****
  1083.   /*
  1084.    *    Order coding inserted into val_order
  1085.    */
  1086. ! #define    O_DMY    0        /* default */
  1087. ! #define O_YMD    1        /* Year/Month/Day */
  1088. ! #define O_MDY    2        /* Month/Day/Year */
  1089. ! #define O_YDM    3        /* Year/Day/Month */
  1090.   
  1091.   /*
  1092.    *    Date structure
  1093. --- 93,105 ----
  1094.   /*
  1095.    *    Order coding inserted into val_order
  1096.    */
  1097. ! #define    O_DMY        0    /* default */
  1098. ! #define O_YMD        1    /* Year/Month/Day */
  1099. ! #define O_MDY        2    /* Month/Day/Year */
  1100. ! #define O_YDM        3    /* Year/Day/Month */
  1101. ! #define    O_WEEKLEFT    4    /* Place day of the week on the left */
  1102. ! #define O_WEEKRIGHT    8    /* Place day of the week on the right */
  1103. ! #define    O_WEEKMASK    O_WEEKLEFT|O_WEEKRIGHT
  1104.   
  1105.   /*
  1106.    *    Date structure
  1107. ***************
  1108. *** 97,102 ****
  1109. --- 108,114 ----
  1110.   {    Cardinal    day;
  1111.       Cardinal    month;
  1112.       Cardinal    year;
  1113. +     Cardinal    wday;
  1114.   } Date;
  1115.   
  1116.   /*
  1117. ***************
  1118. *** 108,115 ****
  1119. --- 120,131 ----
  1120.       Cardinal    me_month;    /* which month */
  1121.       String        me_have[32];    /* if a file present for the day */
  1122.                       /* then will have a non-zero entry */
  1123. +     int        me_type;    /* type of displayed strip */
  1124.   } MonthEntry;
  1125.   
  1126. + #define ME_MONTHLY    1        /* `Normal' monthly strip */
  1127. + #define ME_WEEKLY    2        /* Weekly strip */
  1128.   /*
  1129.    *    An instance of the strip
  1130.    */
  1131. ***************
  1132. *** 150,156 ****
  1133. --- 166,175 ----
  1134.   /*
  1135.    *    Global routines
  1136.    */
  1137. + void    InitAlarms();
  1138. + void    MouseShow();
  1139.   void    Leave();
  1140. + void    Fatal();
  1141.   void    SetDate();
  1142.   void    AskLeave();
  1143.   void    DialogPopup();
  1144. ***************
  1145. *** 158,171 ****
  1146. --- 177,198 ----
  1147.   void    TextCal();
  1148.   void    DoCalendar();
  1149.   void    DoMemo();
  1150. + void    DoWeekly();
  1151.   void    MemoPoll();
  1152.   void    NewMonthStrip();
  1153.   void    InitMonthEntries();
  1154.   void    ChangeHighlight();
  1155.   void    NoEditIsPossible();
  1156. + void    NoDayEditIsPossible();
  1157.   void    StartEditing();
  1158.   MonthEntry *GetMonthEntry();
  1159. + MonthEntry *GetWeeklyEntry();
  1160.   void    AlarmFilePoll();
  1161.   String    ReadCalendarFile();
  1162.   void    UpdateMemo();
  1163.   void    PlaceStr();
  1164. + String    MakeWeeklyName();
  1165. + String    GetWeeklyFile();
  1166. + Boolean    NeedTop();
  1167. + time_t    time();
  1168. *** xcal.man~    Fri Mar 22 23:34:50 1991
  1169. --- xcal.man    Fri Mar 22 23:48:21 1991
  1170. ***************
  1171. *** 21,28 ****
  1172.   program.
  1173.   The format of the command box may be altered using the resource manager, so you
  1174.   are not stuck with my preferred format.
  1175. ! A small button in the top level window can be pressed to inspect todays
  1176. ! appointments and also to edit or display a memo file.
  1177.   .LP
  1178.   The calendar and notebook functions are accessed by clicking the mouse
  1179.   buttons inside date portion of the command window.
  1180. --- 21,31 ----
  1181.   program.
  1182.   The format of the command box may be altered using the resource manager, so you
  1183.   are not stuck with my preferred format.
  1184. ! A small button in the top level window can be pressed to
  1185. ! inspect appointments for today.
  1186. ! This generates a panel showing information from the calendar file for today and
  1187. ! information from a set of seven daily files holding regular commitments.
  1188. ! Finally, the memo panel displays and allows the edit of a memo file.
  1189.   .LP
  1190.   The calendar and notebook functions are accessed by clicking the mouse
  1191.   buttons inside date portion of the command window.
  1192. ***************
  1193. *** 113,123 ****
  1194.   .I Xcal
  1195.   is accessed by pressing the non-date portion of the command window.
  1196.   Currently this shows a bitmap diagram of three mouse buttons.
  1197. ! Clicking the left mouse button in this area brings up a complex panel.
  1198.   The top half of the panel displays the information held in the diary
  1199.   for today; you cannot edit the data from here \- and must open the
  1200.   diary strip to change the data.
  1201. ! The bottom half of the panel is an edit window displaying the contents
  1202.   of a file usually called `memo' in the Calendar directory.
  1203.   The idea of this panel is to allow you to access your current information
  1204.   in one button click.
  1205. --- 116,132 ----
  1206.   .I Xcal
  1207.   is accessed by pressing the non-date portion of the command window.
  1208.   Currently this shows a bitmap diagram of three mouse buttons.
  1209. ! Clicking the left mouse button in this area brings up a complex panel,
  1210. ! clicking on the button again will pop is back down again.
  1211.   The top half of the panel displays the information held in the diary
  1212.   for today; you cannot edit the data from here \- and must open the
  1213.   diary strip to change the data.
  1214. ! The next section of the panel displays the information held in the
  1215. ! weekly files.
  1216. ! Again you cannot directly change the text in this area, you must
  1217. ! press on the Edit button to bring up a strip enabling you to
  1218. ! change things.
  1219. ! The bottom portion of the panel is an edit window displaying the contents
  1220.   of a file usually called `memo' in the Calendar directory.
  1221.   The idea of this panel is to allow you to access your current information
  1222.   in one button click.
  1223. ***************
  1224. *** 197,202 ****
  1225. --- 206,224 ----
  1226.               info    command containing the file data
  1227.   .EE
  1228.   .LP
  1229. + The weekly popup strip is:
  1230. + .EX
  1231. + weekly                the popup shell
  1232. +     weekly            panel containing the strip
  1233. +         header        label containing the title
  1234. +         action        form containing quit and help
  1235. +             quit    command containing exit button
  1236. +             help    command generating help
  1237. +         shortday    form containing days
  1238. +             label    label containing day of the week
  1239. +             info    command containing the file data
  1240. + .EE
  1241. + .LP
  1242.   The Edit Window is:
  1243.   .EX
  1244.   edit                the popup shell
  1245. ***************
  1246. *** 203,209 ****
  1247.       panel            the panel inside the shell
  1248.           title        the form containing the first line
  1249.               quit    the exit button
  1250. ! .EE
  1251.   .LP
  1252.   The Help Window is:
  1253.   .EX
  1254. --- 225,231 ----
  1255.       panel            the panel inside the shell
  1256.           title        the form containing the first line
  1257.               quit    the exit button
  1258. ! .EE    
  1259.   .LP
  1260.   The Help Window is:
  1261.   .EX
  1262. ***************
  1263. *** 234,239 ****
  1264. --- 256,265 ----
  1265.               help    the help button
  1266.               date    display today's date
  1267.           display        text from today's date file
  1268. +         weeklyMemo    form for the Memo title line
  1269. +             weeklyEdit    Edit button
  1270. +             weeklyTitle    Title area
  1271. + 2        display        text from today's weekly file
  1272.           memoMiddle    Middle line form widget
  1273.               save    Save button
  1274.               memoTitle    text title of middle line
  1275. ***************
  1276. *** 299,316 ****
  1277.   If true display the output in reverse video.
  1278.   .IP
  1279.   .B Format
  1280. ! The \fIprintf\fP string used to create the contents of the top command
  1281. ! button.
  1282. ! The default is "%2d %s %d", the arguments to this command are presented
  1283.   in a default order: day, month string and year.
  1284. ! The order is controlled by the Order resource which contains the default
  1285. ! string "dmy".
  1286. ! These two resources should allow all forms of date printing.
  1287.   .TP
  1288.   .B Order
  1289. ! Legal combinations are: dmy, ymd, mdy, ydm.
  1290. ! The default is dmy.
  1291.   .TP
  1292.   .B MarkBackground
  1293.   The background colour for highlighting entries.
  1294.   Default Black.
  1295. --- 325,371 ----
  1296.   If true display the output in reverse video.
  1297.   .IP
  1298.   .B Format
  1299. ! The \fIprintf\fP format used to create the contents of the top command button,
  1300. ! the title in an edit window and the title in the memo window.
  1301. ! The default is "%s %2d %s %d", the arguments to this command are presented
  1302.   in a default order: day, month string and year.
  1303. ! The order is controlled by the Order resource, this contains the default
  1304. ! string "wdmy".
  1305.   .TP
  1306.   .B Order
  1307. ! This resource gives the order that various arguments are presented to the
  1308. ! printf using the format string defined above.
  1309. ! Legal combinations using day, month and year are: dmy, ymd, mdy, ydm.
  1310. ! The name of today can be inserted at the start of the string by
  1311. ! using one of the formats: wdmy, wymd, wmdy, wydm.
  1312. ! It can be entered at the end by using on of the formats: dmyw, ymdw, mdyw, ydmw.
  1313. ! In case you are wondering the `w' stands for `day' of the week.
  1314. ! Beware that altering this resource from
  1315. ! the default may force you to change the format string,
  1316. ! see the previous resource.
  1317. ! The default is wdmy.
  1318.   .TP
  1319. + .B DateYearIsTwoDigits
  1320. + The display of the year in the date strip is controlled
  1321. + the format above.
  1322. + If this resource is true then the year will be displayed as a two
  1323. + digit number; if false the whole four digits will be displayed.
  1324. + Default: False.
  1325. + .TP
  1326. + .B EditYearIsTwoDigits
  1327. + The display of the year in the edit boxes is controlled by
  1328. + the format above.
  1329. + If this resource is true then the year will be displayed as a two
  1330. + digit number; if false the whole four digits will be displayed.
  1331. + Default: False.
  1332. + .TP
  1333. + .B MemoYearIsTwoDigits
  1334. + The display of the year in the memo box is controlled
  1335. + the format above.
  1336. + If this resource is true then the year will be displayed as a two
  1337. + digit number; if false the whole four digits will be displayed.
  1338. + Default: False.
  1339. + .TP
  1340.   .B MarkBackground
  1341.   The background colour for highlighting entries.
  1342.   Default Black.
  1343. ***************
  1344. *** 362,367 ****
  1345. --- 417,426 ----
  1346.   If False, the edit window is not automatically displayed.
  1347.   Default: False.
  1348.   .TP
  1349. + .B InitialMemo
  1350. + If True then the memo window is automatically displayed on startup.
  1351. + Default: False.
  1352. + .TP
  1353.   .B UseWmTitle
  1354.   If True display the month and the year at the head of each strip.
  1355.   This information is duplicated if your window manager uses titles
  1356. ***************
  1357. *** 485,491 ****
  1358.   .B Sunday
  1359.   .B Monday
  1360.   and so on.
  1361. ! The names of the days, these are currently set to a three character short form.
  1362.   .SH FILES
  1363.   .PP
  1364.    $HOME/Calendar/*
  1365. --- 544,560 ----
  1366.   .B Sunday
  1367.   .B Monday
  1368.   and so on.
  1369. ! The \fIlong\fP names of the days: Sunday, Monday etc.
  1370. ! These are used in titles: the top level widget, the title of an edit window
  1371. ! and the memo frame.
  1372. ! .TP
  1373. ! .B Sun
  1374. ! .B Mon
  1375. ! and so on.
  1376. ! The short names of the days \- used in date strips.
  1377. ! .TP
  1378. ! .B Weekly
  1379. ! The word `Weekly' used in various places.
  1380.   .SH FILES
  1381.   .PP
  1382.    $HOME/Calendar/*
  1383. ***************
  1384. *** 496,501 ****
  1385. --- 565,576 ----
  1386.   .TP
  1387.   xy<Year>
  1388.   A year directory.
  1389. + .TP
  1390. + xw<Day>
  1391. + A data file for the weekly code, one per day.
  1392. + .TP
  1393. + memo
  1394. + The memo file.
  1395.   .LP
  1396.   The standard resource database can be found in /usr/lib/X11/app-defaults/Xcal.
  1397.   Assuming that this is where the system admin installed it.
  1398. ***************
  1399. *** 514,519 ****
  1400. --- 589,596 ----
  1401.   Countdown does not work in the early hours of the morning, if you have a
  1402.   ten minute countdown and an alarm set at 0005 \- then you will not get
  1403.   warning at 2325.
  1404. + .LP
  1405. + Alarms set at 0000 probably won't work.
  1406.   .SH AUTHOR
  1407.   .LP
  1408.   Copyright 1989,1990 by Peter Collinson, Hillside Systems
  1409. *** xcal_alarm.c~    Fri Mar 22 23:34:52 1991
  1410. --- xcal_alarm.c    Fri Mar 22 23:48:22 1991
  1411. ***************
  1412. *** 1,5 ****
  1413.   #ifndef lint
  1414. ! static char    *sccsid = "@(#)xcal_alarm.c    1.10 (Hillside Systems) 12/12/90";
  1415.   static char    *copyright = "@(#)Copyright 1989/1990 Mark Majhor, Peter Collinson";
  1416.   #endif  /* lint */
  1417.   /***
  1418. --- 1,5 ----
  1419.   #ifndef lint
  1420. ! static char    *sccsid = "@(#)xcal_alarm.c    1.13 (Hillside Systems) 1/16/91";
  1421.   static char    *copyright = "@(#)Copyright 1989/1990 Mark Majhor, Peter Collinson";
  1422.   #endif  /* lint */
  1423.   /***
  1424. ***************
  1425. *** 44,54 ****
  1426.   #define scrollVertical    0x02
  1427.   #endif
  1428.   
  1429. ! static struct stat stbuf;
  1430. ! static Boolean  false = False;
  1431. ! static Boolean  true = True;
  1432. ! static char    *LocalMapStem;
  1433. ! static Boolean  LocalFoundCalendarFile;
  1434.   static Alarm    head;
  1435.   static int    *countDown;
  1436.   static int    countDownCt;
  1437. --- 44,51 ----
  1438.   #define scrollVertical    0x02
  1439.   #endif
  1440.   
  1441. ! static char    *LocalMapStem;
  1442. ! static char    *TodayFile;
  1443.   static Alarm    head;
  1444.   static int    *countDown;
  1445.   static int    countDownCt;
  1446. ***************
  1447. *** 169,175 ****
  1448.       struct    tm    *tm;
  1449.   {
  1450.       time_t    ti;
  1451. !     struct    stat stbuf;
  1452.       char    *home;
  1453.       char    buf[256];
  1454.       char    *getenv();
  1455. --- 166,172 ----
  1456.       struct    tm    *tm;
  1457.   {
  1458.       time_t    ti;
  1459. !     int    files;
  1460.       char    *home;
  1461.       char    buf[256];
  1462.       char    *getenv();
  1463. ***************
  1464. *** 209,236 ****
  1465.           if (LocalMapStem)
  1466.               XtFree(LocalMapStem);
  1467.           LocalMapStem = XtNewString(buf);
  1468. !         dprintf("Todays Filename = %s\n", LocalMapStem);
  1469.       }
  1470.   
  1471.       /*
  1472.        *    check for file existence
  1473.        */
  1474. !     if (access(LocalMapStem, F_OK))
  1475. !     {    FreeAlarmList();
  1476. !         UpdateMemo();
  1477. !         return;
  1478. !     }
  1479.   
  1480. !     if (stat(LocalMapStem, &stbuf) < 0)
  1481. !         Fatal("Panic: cannot stat %s\n", LocalMapStem);
  1482.   
  1483. !     if (stbuf.st_size != appResources.last_size ||
  1484. !         stbuf.st_mtime > appResources.last_time)
  1485. !     {    appResources.last_size = stbuf.st_size;
  1486. !         appResources.last_time = stbuf.st_mtime;
  1487. !         AlarmScan(LocalMapStem, tm, MINUTES(tm->tm_hour, tm->tm_min));
  1488. !         UpdateMemo();
  1489.       }
  1490.   }
  1491.   
  1492.   static void
  1493. --- 206,240 ----
  1494.           if (LocalMapStem)
  1495.               XtFree(LocalMapStem);
  1496.           LocalMapStem = XtNewString(buf);
  1497. !         dprintf("Todays Daily Filename = %s\n", LocalMapStem);
  1498. !         if (TodayFile)
  1499. !             XtFree(TodayFile);
  1500. !         TodayFile = MakeWeeklyName(today.wday);
  1501.       }
  1502.   
  1503. +     files = 0;
  1504.       /*
  1505.        *    check for file existence
  1506.        */
  1507. !     if (access(LocalMapStem, F_OK) == 0)
  1508. !         files = 1;
  1509. !     if (access(TodayFile, F_OK) == 0)
  1510. !         files |= 2;
  1511.   
  1512. !     FreeAlarmList();
  1513.   
  1514. !     if (files)
  1515. !     {    if (files&1)
  1516. !             AlarmScan(LocalMapStem, tm, MINUTES(tm->tm_hour, tm->tm_min));
  1517. !         if (files&2)
  1518. !             AlarmScan(TodayFile, tm, MINUTES(tm->tm_hour, tm->tm_min));
  1519.       }
  1520. +     else
  1521. +         dprintf("No files to scan");
  1522. +     UpdateMemo();
  1523.   }
  1524.   
  1525.   static void
  1526. ***************
  1527. *** 247,256 ****
  1528.       Boolean        isAction;
  1529.   
  1530.   
  1531. !     dprintf("Scanning data file\n");
  1532.   
  1533. -     FreeAlarmList();
  1534.       if ((fp = fopen(file, "r")) == NULL)
  1535.       {    fprintf(stderr, "Unexpected failure to open: %s\n", file);
  1536.           exit(1);
  1537. --- 251,258 ----
  1538.       Boolean        isAction;
  1539.   
  1540.   
  1541. !     dprintf("Scanning data file %s\n", file);
  1542.   
  1543.       if ((fp = fopen(file, "r")) == NULL)
  1544.       {    fprintf(stderr, "Unexpected failure to open: %s\n", file);
  1545.           exit(1);
  1546. ***************
  1547. *** 308,314 ****
  1548.   {
  1549.   
  1550.       Alarm        *al, *prev, *new;
  1551. -     int            bo;
  1552.       char           *XtMalloc();
  1553.       int        al_hr, al_mn, mm;
  1554.       int        loop;
  1555. --- 310,315 ----
  1556. ***************
  1557. *** 393,399 ****
  1558.           LookSp,    LoseSp,    Store,    AllDone
  1559.       } state;
  1560.       register int    c = 0;
  1561. !     int             hr, mn;
  1562.       char           *destp;
  1563.   
  1564.       if (feof(fin))
  1565. --- 394,400 ----
  1566.           LookSp,    LoseSp,    Store,    AllDone
  1567.       } state;
  1568.       register int    c = 0;
  1569. !     int             hr = 0, mn = 0;
  1570.       char           *destp;
  1571.   
  1572.       if (feof(fin))
  1573. ***************
  1574. *** 522,528 ****
  1575.   {
  1576.       Alarm    *sc;
  1577.       int    togo;
  1578. -     int    mwanted;
  1579.       
  1580.       for (sc = head.next; sc; sc = sc->next)
  1581.       {    togo = sc->alarm_mm - mnow;
  1582. --- 523,528 ----
  1583. ***************
  1584. *** 586,592 ****
  1585.   beep()
  1586.   {
  1587.       register Display *dpy = XtDisplay(toplevel);
  1588. -     register Window win = XtWindow(toplevel);
  1589.       int i;
  1590.   
  1591.       for (i = 0; i < appResources.nbeeps; i++)
  1592. --- 586,591 ----
  1593. *** xcal_cal.c~    Fri Mar 22 23:34:49 1991
  1594. --- xcal_cal.c    Fri Mar 22 23:48:20 1991
  1595. ***************
  1596. *** 45,54 ****
  1597.   #include <ctype.h>
  1598.   #include <sys/param.h>
  1599.   #include <sys/types.h>
  1600.   #include <sys/dir.h>
  1601.   #include <time.h>
  1602. - #include <strings.h>
  1603.   
  1604.   char    *directory    = "Calendar";
  1605.   char    *file        = ".xcal";
  1606.   char    *home;
  1607. --- 45,63 ----
  1608.   #include <ctype.h>
  1609.   #include <sys/param.h>
  1610.   #include <sys/types.h>
  1611. + #ifdef SYSV
  1612. + #include <dirent.h>
  1613. + #include <string.h>
  1614. + #else
  1615. + #include <strings.h>
  1616. + #endif
  1617.   #include <sys/dir.h>
  1618.   #include <time.h>
  1619.   
  1620. + #ifdef SYSV
  1621. + #define    index    strchr
  1622. + #endif
  1623.   char    *directory    = "Calendar";
  1624.   char    *file        = ".xcal";
  1625.   char    *home;
  1626. *** xcal_edit.c~    Fri Mar 22 23:34:53 1991
  1627. --- xcal_edit.c    Fri Mar 22 23:48:22 1991
  1628. ***************
  1629. *** 1,5 ****
  1630.   #ifndef lint
  1631. ! static char *sccsid = "@(#)xcal_edit.c    3.9 (Hillside Systems) 12/13/90";
  1632.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  1633.   #endif  /* lint */
  1634.   /***
  1635. --- 1,5 ----
  1636.   #ifndef lint
  1637. ! static char *sccsid = "@(#)xcal_edit.c    3.15 (Hillside Systems) 1/16/91";
  1638.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  1639.   #endif  /* lint */
  1640.   /***
  1641. ***************
  1642. *** 63,68 ****
  1643. --- 63,70 ----
  1644.   #define mw_month mw_me.me_month
  1645.   #define mw_have    mw_me.me_have
  1646.   
  1647. + #define    StripType(mw)    (mw->mw_me.me_type)
  1648.   static MeWrap *WrapBase;        /* base of the list */
  1649.   static MeWrap *WrapEnd;            /* the last one in the list */
  1650.   
  1651. ***************
  1652. *** 84,89 ****
  1653. --- 86,92 ----
  1654.   static MeWrap *MeWrapSearch();
  1655.   static    void DeRegisterMonth();
  1656.   static Boolean WriteCalendarFile();
  1657. + static Boolean WriteWeeklyFile();
  1658.   static void DeleteCalendarFile();
  1659.   static void SetAllButtons();
  1660.   static void TextChanged();
  1661. ***************
  1662. *** 93,98 ****
  1663. --- 96,102 ----
  1664.   static void CheckDia();
  1665.   static void YesCheck();
  1666.   static void NoCheck();
  1667. + static int DayMatch();
  1668.   void    StartDayEditor();
  1669.   void    Fatal();
  1670.   
  1671. ***************
  1672. *** 202,209 ****
  1673.       while ((dp = readdir(dirp)) != NULL)
  1674.       {
  1675.   #ifdef SYSV
  1676. !         int d_namlen = strlen(dp->d_name) +1;
  1677. !         switch(d_namlen)
  1678.   #else
  1679.           switch(dp->d_namlen)
  1680.   #endif
  1681. --- 206,212 ----
  1682.       while ((dp = readdir(dirp)) != NULL)
  1683.       {
  1684.   #ifdef SYSV
  1685. !         switch(strlen(dp->d_name))
  1686.   #else
  1687.           switch(dp->d_namlen)
  1688.   #endif
  1689. ***************
  1690. *** 272,277 ****
  1691. --- 275,341 ----
  1692.   }
  1693.   
  1694.   /*
  1695. +  *    Get the entry for the weekly strip
  1696. +  *    Files are xw<Day> in the Calendar directory
  1697. +  */
  1698. + MonthEntry *
  1699. + GetWeeklyEntry(yr, mo)
  1700. +     Cardinal    yr;
  1701. +     Cardinal    mo;
  1702. + {
  1703. +     MeWrap        *mw;
  1704. +     int        da;
  1705. +     DIR        *dirp;
  1706. + #ifdef SYSV
  1707. +     struct    dirent    *dp;
  1708. + #else
  1709. +     struct    direct    *dp;
  1710. + #endif
  1711. +     if ((mw = MeWrapSearch(0, 0)) == NULL)
  1712. +         mw = NewMeWrap(0, 0);
  1713. +     if (!FoundCalendarDir)
  1714. +         return(&mw->mw_me);
  1715. +     if ((dirp = opendir(".")) == NULL)
  1716. +         Fatal("Cannot open directory: %s", MapStem);
  1717. +     for (da = 0; da < 7; da++)
  1718. +         if (mw->mw_have[da])
  1719. +         {    XtFree(mw->mw_have[da]);
  1720. +             mw->mw_have[da] = NULL;
  1721. +         }
  1722. +     while ((dp = readdir(dirp)) != NULL)
  1723. +     {
  1724. +         if (dp->d_name[0] == 'x' &&
  1725. +             dp->d_name[1] == 'w' &&
  1726. +             ((da = DayMatch(&dp->d_name[2])) != -1))
  1727. +         {
  1728. +             mw->mw_have[da] = ReadCalendarFile(NULL, dp->d_name);
  1729. +         }
  1730. +     }
  1731. +     closedir(dirp);
  1732. +     return(&mw->mw_me);
  1733. + }
  1734. + /*
  1735. +  *    Look for a short name match with a day
  1736. +  */
  1737. + static int
  1738. + DayMatch(day)
  1739. +     String    day;
  1740. + {
  1741. +     register i;
  1742. +     for (i = 0; i < 7; i++)
  1743. +         if (strcmp(day, appResources.sday[i]) == 0)
  1744. +             return(i);
  1745. +     return (-1);
  1746. + }
  1747. + /*
  1748.    *    create a new MapWrap area
  1749.    */
  1750.   static MeWrap *
  1751. ***************
  1752. *** 335,341 ****
  1753.   
  1754.       callbacks[0].callback = DeRegisterMonth;
  1755.   #ifdef LONG_IS_32_BITS
  1756. !     callbacks[0].closure = (caddr_t)DatePack(0, mo, yr);
  1757.   #else
  1758.       callbacks[0].closure = (caddr_t)DatePack(mo, yr);
  1759.   #endif        
  1760. --- 399,405 ----
  1761.   
  1762.       callbacks[0].callback = DeRegisterMonth;
  1763.   #ifdef LONG_IS_32_BITS
  1764. !     callbacks[0].closure = (caddr_t)DatePack(0, 0, mo, yr);
  1765.   #else
  1766.       callbacks[0].closure = (caddr_t)DatePack(mo, yr);
  1767.   #endif        
  1768. ***************
  1769. *** 434,439 ****
  1770. --- 498,529 ----
  1771.   }
  1772.   
  1773.   /*
  1774. +  *    Check to see if we should create the top directory
  1775. +  */
  1776. + Boolean
  1777. + NeedTop()
  1778. + {        
  1779. +     if (!FoundCalendarDir)
  1780. +     {    if (mkdir(MapStem, 0700) == -1)
  1781. +         {    XBell(XtDisplay(toplevel), 0);
  1782. +             fprintf(stderr, "xcal: Could not create: %s directory.\n", MapStem);
  1783. +             perror("xcal: mkdir");
  1784. +             fflush(stderr);
  1785. +             return(False);
  1786. +         }
  1787. +         if (chdir(MapStem) < 0)
  1788. +         {    XBell(XtDisplay(toplevel), 0);
  1789. +             fprintf(stderr, "xcal: Could not chdir into %s.\n", MapStem);
  1790. +             perror("xcal: chdir");
  1791. +             fflush(stderr);
  1792. +             return(False);
  1793. +         }
  1794. +         FoundCalendarDir = True;
  1795. +     }
  1796. +     return(True);
  1797. + }
  1798. + /*
  1799.    *    Write a calendar file creating any directories
  1800.    *    which are needed
  1801.    *    Return True is OK
  1802. ***************
  1803. *** 454,481 ****
  1804.       {    DeleteCalendarFile(mw, day);
  1805.           return(True);
  1806.       }
  1807.       /*
  1808. -      *    First let's see if we have 
  1809. -      *    to create the toplevel directory
  1810. -      */
  1811. -     if (!FoundCalendarDir)
  1812. -     {    if (mkdir(MapStem, 0700) == -1)
  1813. -         {    XBell(XtDisplay(toplevel), 0);
  1814. -             fprintf(stderr, "xcal: Could not create: %s directory.\n", MapStem);
  1815. -             perror("xcal: mkdir");
  1816. -             fflush(stderr);
  1817. -             return(False);
  1818. -         }
  1819. -         if (chdir(MapStem) < 0)
  1820. -         {    XBell(XtDisplay(toplevel), 0);
  1821. -             fprintf(stderr, "xcal: Could not chdir into %s.\n", MapStem);
  1822. -             perror("xcal: chdir");
  1823. -             fflush(stderr);
  1824. -             return(False);
  1825. -         }
  1826. -         FoundCalendarDir = True;
  1827. -     }
  1828. -     /*
  1829.        *    So that looks OK
  1830.        *    We can now create the output file.
  1831.        *    However, we would like to put any new data into subdirectories
  1832. --- 544,553 ----
  1833.       {    DeleteCalendarFile(mw, day);
  1834.           return(True);
  1835.       }
  1836. +     if (!NeedTop())
  1837. +         return(False);
  1838.       /*
  1839.        *    So that looks OK
  1840.        *    We can now create the output file.
  1841.        *    However, we would like to put any new data into subdirectories
  1842. ***************
  1843. *** 570,575 ****
  1844. --- 642,726 ----
  1845.   }
  1846.   
  1847.   /*
  1848. +  *    Write daily file out
  1849. +  */
  1850. + static Boolean
  1851. + WriteWeeklyFile(mw, day, contents)
  1852. +     register MeWrap    *mw;
  1853. +     Cardinal    day;
  1854. +     char        *contents;
  1855. + {
  1856. +     int    fd;
  1857. +     Cardinal len;
  1858. +     char    *fname;
  1859. +     fname = MakeWeeklyName(day);
  1860. +     
  1861. +     len = strlen(contents);
  1862. +     if (len == 0)
  1863. +         (void) unlink(fname);
  1864. +     else
  1865. +     {    if ((fd = open(fname, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0)
  1866. +         {    XBell(XtDisplay(toplevel), 0);
  1867. +             fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname);
  1868. +             perror("xcal: open");
  1869. +             fflush(stderr);
  1870. +             return(False);
  1871. +         }
  1872. +         if (write(fd, contents, len) != len)
  1873. +         {    XBell(XtDisplay(toplevel), 0);
  1874. +             fprintf(stderr, "xcal: Write error %s/%s file.\n", MapStem, fname);
  1875. +             perror("xcal: write");
  1876. +             fflush(stderr);
  1877. +             close(fd);
  1878. +             return(False);
  1879. +         }
  1880. +         close(fd);
  1881. +     }
  1882. +     /*
  1883. +      *    tickle the alarm system if we have altered `today'
  1884. +      */
  1885. +     if (today.wday == day)
  1886. +         AlarmFilePoll(NULL);
  1887. +     return(True);
  1888. + }
  1889. + /*
  1890. +  *    Create a standard weekly file name
  1891. +  */
  1892. + String
  1893. + MakeWeeklyName(day)
  1894. +     Cardinal day;
  1895. + {
  1896. +     static    char    fname[16];
  1897. +     (void) sprintf(fname, "xw%s", appResources.sday[day]);
  1898. +     return(fname);
  1899. + }
  1900. + /*
  1901. +  *    Get the contents of the current Weekly file if any
  1902. +  */
  1903. + String
  1904. + GetWeeklyFile(day)
  1905. +     Cardinal day;
  1906. + {
  1907. +     char    *fname;
  1908. +     if (FoundCalendarDir == False)
  1909. +         return (NULL);
  1910. +     fname = MakeWeeklyName(day);
  1911. +     if (access(fname, F_OK) < 0)
  1912. +         return(NULL);
  1913. +     return (ReadCalendarFile(NULL, fname));
  1914. + }
  1915. + /*
  1916.    *    Start up an editor window from the callback
  1917.    *    Pass the calling widget so we can change its contents
  1918.    *    after the edit
  1919. ***************
  1920. *** 592,598 ****
  1921.       {    if (ed->ed_day == da->day)
  1922.           {    /* we are! */
  1923.               /* Complain via a popup */
  1924. !             NoEditIsPossible(w, da);
  1925.               return;
  1926.           }
  1927.       }
  1928. --- 743,757 ----
  1929.       {    if (ed->ed_day == da->day)
  1930.           {    /* we are! */
  1931.               /* Complain via a popup */
  1932. !             switch (StripType(mw))
  1933. !             {
  1934. !             case ME_MONTHLY:
  1935. !                 NoEditIsPossible(w, da);
  1936. !                 break;
  1937. !             case ME_WEEKLY:
  1938. !                 NoDayEditIsPossible(w, da->day);
  1939. !                 break;
  1940. !             }
  1941.               return;
  1942.           }
  1943.       }
  1944. ***************
  1945. *** 724,730 ****
  1946.           lw = XtCreateManagedWidget("help", commandWidgetClass, frame, args, nargs);
  1947.       }
  1948.   
  1949. !     PlaceStr(buf, da->day, appResources.mon[da->month], da->year);
  1950.       nargs = 0;
  1951.       XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  1952.       XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
  1953. --- 883,897 ----
  1954.           lw = XtCreateManagedWidget("help", commandWidgetClass, frame, args, nargs);
  1955.       }
  1956.   
  1957. !     switch (StripType(mw))
  1958. !     {
  1959. !     case ME_MONTHLY:
  1960. !         PlaceStr(buf, da, appResources.editYearIs2);
  1961. !         break;
  1962. !     case ME_WEEKLY:
  1963. !         (void) strcpy(buf, appResources.day[da->day]);
  1964. !         break;
  1965. !     }
  1966.       nargs = 0;
  1967.       XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  1968.       XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
  1969. ***************
  1970. *** 786,799 ****
  1971.       register Instance *ins;
  1972.       register MeWrap    *mw;
  1973.       register Cardinal day;
  1974. -     extern    Widget    toplevel;
  1975.       Arg    args[3];
  1976.       
  1977.       mw = ed->ed_meWrap;
  1978.       day = ed->ed_day;
  1979.       
  1980. !     if (WriteCalendarFile(mw, day, ed->ed_data) == False)
  1981. !         return;
  1982.       /*
  1983.        *    Otherwise change the displayed string
  1984.        */
  1985. --- 953,974 ----
  1986.       register Instance *ins;
  1987.       register MeWrap    *mw;
  1988.       register Cardinal day;
  1989.       Arg    args[3];
  1990.       
  1991.       mw = ed->ed_meWrap;
  1992.       day = ed->ed_day;
  1993.       
  1994. !     switch (StripType(mw))
  1995. !     {
  1996. !     case ME_MONTHLY:
  1997. !         if (WriteCalendarFile(mw, day, ed->ed_data) == False)
  1998. !             return;
  1999. !         break;
  2000. !     case ME_WEEKLY:
  2001. !         if (WriteWeeklyFile(mw, day, ed->ed_data) == False)
  2002. !             return;
  2003. !         break;
  2004. !     }
  2005.       /*
  2006.        *    Otherwise change the displayed string
  2007.        */
  2008. ***************
  2009. *** 819,827 ****
  2010.       /*
  2011.        * worry about updating the memo system
  2012.        */
  2013. !     if (today.day == day && today.month == mw->mw_month &&
  2014. !         today.year == mw->mw_year)
  2015. !         UpdateMemo();
  2016.   
  2017.   }
  2018.   
  2019. --- 994,1012 ----
  2020.       /*
  2021.        * worry about updating the memo system
  2022.        */
  2023. !     switch (StripType(mw))
  2024. !     {
  2025. !     case ME_MONTHLY:
  2026. !         if (today.day == day && today.month == mw->mw_month &&
  2027. !             today.year == mw->mw_year)
  2028. !             UpdateMemo();
  2029. !         break;
  2030. !     case ME_WEEKLY:
  2031. !         if (today.wday == day)
  2032. !             UpdateMemo();
  2033. !         break;
  2034. !     }
  2035.   
  2036.   }
  2037.   
  2038. *** xcal_help.c~    Fri Mar 22 23:34:49 1991
  2039. --- xcal_help.c    Fri Mar 22 23:48:20 1991
  2040. ***************
  2041. *** 1,5 ****
  2042.   #ifndef lint
  2043. ! static char *sccsid = "@(#)xcal_help.c    3.5 (Hillside Systems) 12/7/90";
  2044.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2045.   #endif  /* lint */
  2046.   /***
  2047. --- 1,5 ----
  2048.   #ifndef lint
  2049. ! static char *sccsid = "@(#)xcal_help.c    3.6 (Hillside Systems) 1/16/91";
  2050.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2051.   #endif  /* lint */
  2052.   /***
  2053. ***************
  2054. *** 223,225 ****
  2055. --- 223,260 ----
  2056.   
  2057.       DisplayHelpWindow(memoHelp);
  2058.   }
  2059. + static char weeklyHelp[] = "\
  2060. + The weekly strip consists of a number of lines of text. \n\n\
  2061. + Line 1: The title\n\
  2062. + Line 2: The Quit button that removes the strip from the screen\n\
  2063. + Line 3: The Help Button.\n\
  2064. +     Help can be suppressed by setting `giveHelp' to False.\n\n\
  2065. + Then -  A line for each day in the week.\n\
  2066. +     Each line is two areas:\n\
  2067. +     The left hand side shows the day in the week\n\
  2068. +     The right hand side is an active button. When pressed it starts\n\
  2069. +     up an editor for the day. This will create a file for the day\n\
  2070. +     in the user's Calendar directory. The label on the button will\n\
  2071. +     be the first few characters of the file, if there are any.\n\
  2072. + \n\
  2073. + XCal was written by Peter Collinson\n\
  2074. + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
  2075. +     
  2076. + /* ARGSUSED */
  2077. + void
  2078. + WeeklyHelp(w, closure, call_data)
  2079. +     Widget w;
  2080. +     caddr_t    closure;
  2081. +     caddr_t call_data;
  2082. + {
  2083. +     static int vadded;
  2084. +     if (vadded == 0)
  2085. +     {    vadded = 1;
  2086. +         addversion(weeklyHelp);
  2087. +     }
  2088. +     DisplayHelpWindow(weeklyHelp);
  2089. + }
  2090. *** xcal_memo.c~    Fri Mar 22 23:34:51 1991
  2091. --- xcal_memo.c    Fri Mar 22 23:48:21 1991
  2092. ***************
  2093. *** 1,5 ****
  2094.   #ifndef lint
  2095. ! static char *sccsid = "@(#)xcal_memo.c    1.5 (Hillside Systems) 12/13/90";
  2096.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2097.   #endif  /* lint */
  2098.   /***
  2099. --- 1,5 ----
  2100.   #ifndef lint
  2101. ! static char *sccsid = "@(#)xcal_memo.c    1.11 (Hillside Systems) 1/16/91";
  2102.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2103.   #endif  /* lint */
  2104.   /***
  2105. ***************
  2106. *** 53,69 ****
  2107.       Widget    m_display;    /* widget of display title area */
  2108.       Widget    m_text;        /* the text area */
  2109.       Widget    m_today;    /* today's data */
  2110.       Cardinal m_size;    /* size of the buffer */
  2111.       char    *m_data;    /* pointer to malloc'ed data buffer */
  2112.   } MemoEdit;
  2113.   
  2114.   static    MemoEdit memo;
  2115. - String    GetMemoFile();
  2116.   
  2117.   extern    Boolean FoundCalendarDir;               /* whether the Calendar directory exists */
  2118.   
  2119.   static    String    memoContents;
  2120.   
  2121.   
  2122.   /*
  2123.    *    Internal routines
  2124. --- 53,70 ----
  2125.       Widget    m_display;    /* widget of display title area */
  2126.       Widget    m_text;        /* the text area */
  2127.       Widget    m_today;    /* today's data */
  2128. +     Widget    m_weekly;    /* widget of text image of weekly events */
  2129.       Cardinal m_size;    /* size of the buffer */
  2130.       char    *m_data;    /* pointer to malloc'ed data buffer */
  2131.   } MemoEdit;
  2132.   
  2133.   static    MemoEdit memo;
  2134.   
  2135.   extern    Boolean FoundCalendarDir;               /* whether the Calendar directory exists */
  2136.   
  2137.   static    String    memoContents;
  2138.   
  2139. + extern void MemoHelp();                /* look in xcal_help.c */
  2140.   
  2141.   /*
  2142.    *    Internal routines
  2143. ***************
  2144. *** 77,83 ****
  2145.   static String GetMemoFile();
  2146.   static void SaveMemoEdits();
  2147.   static void MemoTextChanged();
  2148. - static void MemoHelp();
  2149.   static void FinishMemoEditing();
  2150.   static void YesCheck();
  2151.   static void NoCheck();
  2152. --- 78,83 ----
  2153. ***************
  2154. *** 145,153 ****
  2155.       Widget        frame;
  2156.       Arg        args[10];
  2157.       Cardinal    nargs;
  2158. -     Cardinal    len;
  2159.       String        str;
  2160.       MonthEntry    *me;
  2161.       char        buf[32];
  2162.   
  2163.       /*
  2164. --- 145,153 ----
  2165.       Widget        frame;
  2166.       Arg        args[10];
  2167.       Cardinal    nargs;
  2168.       String        str;
  2169.       MonthEntry    *me;
  2170. +     Dimension    charHeight;
  2171.       char        buf[32];
  2172.   
  2173.       /*
  2174. ***************
  2175. *** 207,213 ****
  2176.       /*
  2177.        *    The remaining bit here is a date label
  2178.        */
  2179. !     PlaceStr(buf, today.day, appResources.mon[today.month], today.year);
  2180.       nargs = 0;
  2181.       XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  2182.       XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
  2183. --- 207,213 ----
  2184.       /*
  2185.        *    The remaining bit here is a date label
  2186.        */
  2187. !     PlaceStr(buf, &today, appResources.memoYearIs2);
  2188.       nargs = 0;
  2189.       XtSetArg(args[nargs], XtNlabel, buf); nargs++;
  2190.       XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
  2191. ***************
  2192. *** 233,244 ****
  2193.   
  2194.           XtSetArg(args[0], XtNheight, &height);
  2195.           XtGetValues(memo.m_today, args, 1);
  2196.           height = height*NewlineCount(str);
  2197.           XtSetArg(args[0], XtNheight, height);
  2198.           XtSetValues(memo.m_today, args, 1);
  2199.       }
  2200. !         
  2201.       /*
  2202.        *    Another form with some buttons
  2203.        */
  2204.       nargs = 0;
  2205. --- 233,294 ----
  2206.   
  2207.           XtSetArg(args[0], XtNheight, &height);
  2208.           XtGetValues(memo.m_today, args, 1);
  2209. +         charHeight = height;
  2210.           height = height*NewlineCount(str);
  2211.           XtSetArg(args[0], XtNheight, height);
  2212.           XtSetValues(memo.m_today, args, 1);
  2213.       }
  2214.       /*
  2215. +      *    Weekly details - the data for today + an edit button
  2216. +      *    The header to this is a form
  2217. +      */
  2218. +     nargs = 0;
  2219. +     XtSetArg(args[nargs], XtNshowGrip, False); nargs++;
  2220. +     XtSetArg(args[nargs], XtNskipAdjust, True); nargs++;
  2221. +     XtSetArg(args[nargs], XtNdefaultDistance, 1); nargs++;
  2222. +     frame = XtCreateManagedWidget("weeklyMemo", formWidgetClass, et, args, nargs);
  2223. +     /*
  2224. +      *    Take label "edit" from resources
  2225. +      */
  2226. +     callbacks[0].callback = DoWeekly;
  2227. +     callbacks[0].closure = (caddr_t)&memo;
  2228. +     nargs = 0;
  2229. +     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2230. +     XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
  2231. +     XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2232. +     XtSetArg(args[nargs], XtNright, XtChainLeft); nargs++;
  2233. +     lw = XtCreateManagedWidget("weeklyEdit", commandWidgetClass, frame, args, nargs);
  2234. +     /*
  2235. +      *    Say this is a weekly commitment
  2236. +      */
  2237. +     nargs = 0;
  2238. +     XtSetArg(args[nargs], XtNshowGrip, True); nargs++;
  2239. +     XtSetArg(args[nargs], XtNborderWidth, 0); nargs++;
  2240. +     XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
  2241. +     XtSetArg(args[nargs], XtNfromVert, NULL); nargs++;
  2242. +     XtSetArg(args[nargs], XtNvertDistance, 2); nargs++;
  2243. +     XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2244. +     XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
  2245. +     lw = XtCreateManagedWidget("weeklyTitle", labelWidgetClass, frame, args, nargs);
  2246. +     /*
  2247. +      *    Details for today
  2248. +      */
  2249. +     nargs = 0;
  2250. +     str = GetWeeklyFile(today.wday);
  2251. +     if (str == NULL)
  2252. +         str = "";
  2253. +     XtSetArg(args[nargs], XtNstring, str); nargs++;
  2254. +     XtSetArg(args[nargs], XtNdisplayCaret, False); nargs++;
  2255. +     XtSetArg(args[nargs], XtNeditType, XawtextRead); nargs++;
  2256. +     if (charHeight)
  2257. +         XtSetArg(args[nargs], XtNheight, NewlineCount(str)*charHeight); nargs++;
  2258. +     memo.m_weekly = XtCreateManagedWidget("display", asciiTextWidgetClass, et, args, nargs);
  2259. +     /*
  2260.        *    Another form with some buttons
  2261.        */
  2262.       nargs = 0;
  2263. ***************
  2264. *** 342,347 ****
  2265. --- 392,404 ----
  2266.       (void) sprintf(buf, "%d %s %d", today.day, appResources.mon[today.month], today.year);
  2267.       XtSetArg(args[0], XtNlabel, buf);
  2268.       XtSetValues(memo.m_display, args, 1);
  2269. +     str = GetWeeklyFile(today.wday);
  2270. +     if (str == NULL)
  2271. +         str = "";
  2272. +     XtSetArg(args[0], XtNstring, str);
  2273. +     XtSetValues(memo.m_weekly, args, 1);
  2274.   }
  2275.   
  2276.   /*
  2277. ***************
  2278. *** 441,465 ****
  2279.        *    First let's see if we have 
  2280.        *    to create the toplevel directory
  2281.        */
  2282. !     if (!FoundCalendarDir)
  2283. !     {    if (mkdir(MapStem, 0700) == -1)
  2284. !         {    XBell(XtDisplay(toplevel), 0);
  2285. !             fprintf(stderr, "xcal: Could not create: %s directory.\n", MapStem);
  2286. !             perror("xcal: mkdir");
  2287. !             fflush(stderr);
  2288. !             return(False);
  2289. !         }
  2290. !         if (chdir(MapStem) < 0)
  2291. !         {    XBell(XtDisplay(toplevel), 0);
  2292. !             fprintf(stderr, "xcal: Could not chdir into %s.\n", MapStem);
  2293. !             perror("xcal: chdir");
  2294. !             fflush(stderr);
  2295. !             return(False);
  2296. !         }
  2297. !         FoundCalendarDir = True;
  2298. !     }
  2299.   
  2300.       fname = appResources.memoFile;
  2301.       if ((fd = open(fname, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0)
  2302.       {    XBell(XtDisplay(toplevel), 0);
  2303.           fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname);
  2304. --- 498,508 ----
  2305.        *    First let's see if we have 
  2306.        *    to create the toplevel directory
  2307.        */
  2308. !     if (!NeedTop())
  2309. !         return (False);
  2310.   
  2311.       fname = appResources.memoFile;
  2312.       if ((fd = open(fname, O_WRONLY|O_TRUNC|O_CREAT, 0666)) < 0)
  2313.       {    XBell(XtDisplay(toplevel), 0);
  2314.           fprintf(stderr, "xcal: Could not open %s/%s for writing.\n", MapStem, fname);
  2315. ***************
  2316. *** 487,493 ****
  2317.       caddr_t call_data;
  2318.   {
  2319.   
  2320. !     if (memoContents == NULL || strcmp(memoContents, memo.m_data))
  2321.       {    MemoCheckExit();
  2322.           return;
  2323.       }
  2324. --- 530,536 ----
  2325.       caddr_t call_data;
  2326.   {
  2327.   
  2328. !     if (memo.m_savesens == True)
  2329.       {    MemoCheckExit();
  2330.           return;
  2331.       }
  2332. *** xcal_popup.c~    Fri Mar 22 23:34:56 1991
  2333. --- xcal_popup.c    Fri Mar 22 23:48:24 1991
  2334. ***************
  2335. *** 1,5 ****
  2336.   #ifndef lint
  2337. ! static char *sccsid = "@(#)xcal_popup.c    3.4 (Hillside Systems) 12/12/90";
  2338.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2339.   #endif  /* lint */
  2340.   /***
  2341. --- 1,5 ----
  2342.   #ifndef lint
  2343. ! static char *sccsid = "@(#)xcal_popup.c    3.5 (Hillside Systems) 1/16/91";
  2344.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2345.   #endif  /* lint */
  2346.   /***
  2347. ***************
  2348. *** 395,400 ****
  2349. --- 395,413 ----
  2350.       static    char    errmsg[32];    
  2351.   
  2352.       (void) sprintf(errmsg, "Already editing %d %s %d", da->day, appResources.mon[da->month], da->year);
  2353. +     DialogPopup(w, NoEdit, errmsg);
  2354. + }
  2355. + void
  2356. + NoDayEditIsPossible(w, day)
  2357. +     Widget    w;
  2358. +     Cardinal day;
  2359. + {
  2360. +     static    char    errmsg[32];    
  2361. +     (void) sprintf(errmsg, "Already editing %s", appResources.day[day]);
  2362.   
  2363.       DialogPopup(w, NoEdit, errmsg);
  2364.   
  2365. *** xcal_strip.c~    Fri Mar 22 23:34:54 1991
  2366. --- xcal_strip.c    Fri Mar 22 23:48:23 1991
  2367. ***************
  2368. *** 1,5 ****
  2369.   #ifndef lint
  2370. ! static char *sccsid = "@(#)xcal_strip.c    3.6 (Hillside Systems) 12/7/90";
  2371.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2372.   #endif  /* lint */
  2373.   /***
  2374. --- 1,5 ----
  2375.   #ifndef lint
  2376. ! static char *sccsid = "@(#)xcal_strip.c    3.10 (Hillside Systems) 1/16/91";
  2377.   static char *copyright = "@(#)Copyright 1989,1990 Peter Collinson, Hillside Systems";
  2378.   #endif  /* lint */
  2379.   /***
  2380. ***************
  2381. *** 45,55 ****
  2382.    */
  2383.   void MakeMonth();
  2384.   void    DayBack();
  2385. ! #ifdef LONG_IS_32_BITS
  2386.   void    YmBack();
  2387.   #endif
  2388.   void    StripQuit();
  2389.   void    MakeNewMonth();
  2390.   
  2391.   Cardinal DateSum();
  2392. --- 45,56 ----
  2393.    */
  2394.   void MakeMonth();
  2395.   void    DayBack();
  2396. ! #ifndef LONG_IS_32_BITS
  2397.   void    YmBack();
  2398.   #endif
  2399.   void    StripQuit();
  2400. ! void    StripHelp();
  2401. ! void    WeeklyHelp();
  2402.   void    MakeNewMonth();
  2403.   
  2404.   Cardinal DateSum();
  2405. ***************
  2406. *** 56,63 ****
  2407.   Cardinal NumberOfDays();
  2408.   Cardinal FirstDay();
  2409.   Cardinal JanuaryOne();
  2410.   /*
  2411. !  *    Start a strip calendar happening
  2412.    *    a callback of left button 
  2413.    */
  2414.   /* ARGSUSED */
  2415. --- 57,71 ----
  2416.   Cardinal NumberOfDays();
  2417.   Cardinal FirstDay();
  2418.   Cardinal JanuaryOne();
  2419.   /*
  2420. !  *    Local routines
  2421. !  */
  2422. ! static void    CreateActionBar();
  2423. ! static void    CreateWeeklyActionBar();
  2424. ! /*
  2425. ! *    Start a strip calendar happening
  2426.    *    a callback of left button 
  2427.    */
  2428.   /* ARGSUSED */
  2429. ***************
  2430. *** 70,75 ****
  2431. --- 78,100 ----
  2432.       NewMonthStrip(&today);        /* today is global */
  2433.   }
  2434.   
  2435. + /* ARGSUSED */
  2436. + void
  2437. + DoWeekly(w, closure, call_data)
  2438. +     Widget w;
  2439. +     caddr_t    closure;
  2440. +     caddr_t call_data;
  2441. + {
  2442. +     Date    thisday;
  2443. +     thisday.day = 0;
  2444. +     thisday.month = 0;
  2445. +     thisday.year = 0;
  2446. +     thisday.wday = 0;
  2447. +     NewMonthStrip(&thisday);    /* today is global */
  2448. + }
  2449.   /*
  2450.    *    Start a strip calendar happening
  2451.    *    a callback of the > or < buttons in another strip
  2452. ***************
  2453. *** 112,125 ****
  2454.       Date    *td;
  2455.   {
  2456.       Widget        shell, mon, dw, lw, lwi, form;
  2457. !     Arg    args[15];
  2458.       char        nbuf[256];
  2459.       char        iconName[80];
  2460.       MonthEntry    *me;
  2461.       Instance    *ins;
  2462.       register int    i;
  2463.       register Cardinal nargs;
  2464.       Cardinal    thisDay;
  2465.       String        dayStr;
  2466.       Cardinal    numberOfDays;
  2467.       Boolean        defaultsAreSet = False;
  2468. --- 137,152 ----
  2469.       Date    *td;
  2470.   {
  2471.       Widget        shell, mon, dw, lw, lwi, form;
  2472. !     Arg        args[15];
  2473.       char        nbuf[256];
  2474.       char        iconName[80];
  2475. +     int        type;
  2476.       MonthEntry    *me;
  2477.       Instance    *ins;
  2478.       register int    i;
  2479.       register Cardinal nargs;
  2480.       Cardinal    thisDay;
  2481. +     Cardinal    startLoop;
  2482.       String        dayStr;
  2483.       Cardinal    numberOfDays;
  2484.       Boolean        defaultsAreSet = False;
  2485. ***************
  2486. *** 129,161 ****
  2487.       Dimension    labelH, infoH;
  2488.       Dimension    width;
  2489.       Dimension    totalWidth;
  2490. -     void        StripHelp();
  2491.   
  2492. !     (void) sprintf(iconName, "%s %d", appResources.smon[td->month], td->year);
  2493. !     XtSetArg(args[0], XtNiconName, iconName);
  2494. !     shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, 1);
  2495. !     ins = RegisterMonth(td->year, td->month, shell);    
  2496. !     mon = XtCreateManagedWidget(appResources.mon[td->month], panedWidgetClass, shell, NULL, 0);
  2497. !     thisDay = FirstDay(td->month, td->year);
  2498. !     numberOfDays = NumberOfDays(td->month, td->year);
  2499.       /*
  2500. !      *    Get the map for this year
  2501.        */
  2502. !     me = GetMonthEntry(td->year, td->month);
  2503.       /*
  2504. -      *    Title bar is month and date
  2505. -      */
  2506. -     (void) sprintf(nbuf, "%s %d", appResources.mon[td->month], td->year);
  2507. -     /*
  2508. -      *    see if we will need to worry about marking today's entry
  2509. -      */
  2510. -     if (appResources.markToday && td->year == today.year && td->month == today.month)
  2511. -         markThisMonth = True;
  2512. -     /*
  2513.        *    Find size of title bar
  2514.        *    by creating the widget and then throwing it away
  2515.        */
  2516. --- 156,221 ----
  2517.       Dimension    labelH, infoH;
  2518.       Dimension    width;
  2519.       Dimension    totalWidth;
  2520.   
  2521. !     type = (td->day == 0) ? ME_WEEKLY : ME_MONTHLY;
  2522. !     
  2523.       /*
  2524. !      *    There are lots of differences between
  2525. !      *    Months and weekly strips here.
  2526. !      *    Later tests are done using a switch structure
  2527.        */
  2528. !     switch (type)
  2529. !     {
  2530. !     case ME_MONTHLY:
  2531. !         (void) sprintf(iconName, "%s %d", appResources.smon[td->month], td->year);
  2532. !         XtSetArg(args[0], XtNiconName, iconName);
  2533. !         shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, 1);
  2534. !         ins = RegisterMonth(td->year, td->month, shell);    
  2535. !         mon = XtCreateManagedWidget(appResources.mon[td->month], panedWidgetClass, shell, NULL, 0);
  2536. !         thisDay = FirstDay(td->month, td->year);
  2537. !         numberOfDays = NumberOfDays(td->month, td->year);
  2538. !         startLoop = 1;
  2539. !         /*
  2540. !          *    Get the map for this year
  2541. !          */
  2542. !         me = GetMonthEntry(td->year, td->month);
  2543. !         me->me_type = type;
  2544. !         /*
  2545. !          *    Title bar is month and date
  2546. !          */
  2547. !         (void) sprintf(nbuf, "%s %d", appResources.mon[td->month], td->year);
  2548. !         /*
  2549. !          *    see if we will need to worry about marking today's entry
  2550. !          */
  2551. !         if (appResources.markToday && td->year == today.year && td->month == today.month)
  2552. !             markThisMonth = True;
  2553. !         break;
  2554. !     case ME_WEEKLY:
  2555. !         (void) strcpy(iconName, appResources.weekly);
  2556. !         XtSetArg(args[0], XtNiconName, iconName);
  2557. !         shell = XtCreatePopupShell(XtNewString(iconName), topLevelShellWidgetClass, toplevel, args, 1);
  2558. !         ins = RegisterMonth(0, 0, shell);    
  2559. !         mon = XtCreateManagedWidget(iconName, panedWidgetClass, shell, NULL, 0);
  2560. !         thisDay = 0;
  2561. !         numberOfDays = 6;    /* test is <= */
  2562. !         startLoop = 0;
  2563. !         /*
  2564. !          *    Get the map for this year
  2565. !          */
  2566. !         me = GetWeeklyEntry();
  2567. !         me->me_type = type;
  2568. !         /*
  2569. !          *    Title bar is from the resources
  2570. !          */
  2571. !         strcpy(nbuf, iconName);
  2572. !         /*
  2573. !          *    see if we will need to worry about marking today's entry
  2574. !          */
  2575. !         if (appResources.markToday)
  2576. !             markThisMonth = True;
  2577. !         break;
  2578. !     }
  2579.       /*
  2580.        *    Find size of title bar
  2581.        *    by creating the widget and then throwing it away
  2582.        */
  2583. ***************
  2584. *** 185,245 ****
  2585.       XtSetArg(args[nargs], XtNdefaultDistance, 2); nargs++;
  2586.       dw = XtCreateManagedWidget("action", formWidgetClass, mon, args, nargs);
  2587.   
  2588. !     /*
  2589. !      *    back one month
  2590. !      *    label "<" from resources
  2591. !      */
  2592. !     callbacks[0].callback = MakeNewMonth;
  2593. !     callbacks[0].closure = (caddr_t)DateSum(td, -1);
  2594. !     nargs = 0;
  2595. !     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2596. !     XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
  2597. !     XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2598. !     XtSetArg(args[nargs], XtNright, XtChainLeft); nargs++;
  2599. !     lw = XtCreateManagedWidget("back", commandWidgetClass, dw, args, nargs);
  2600. !     ClearCallbacks();
  2601. !     /*
  2602. !      *    Quit button
  2603. !      *    label "quit" from resources
  2604. !      */
  2605. !     callbacks[0].callback = StripQuit;
  2606. !     callbacks[0].closure = (caddr_t)shell;
  2607. !     nargs = 0;
  2608. !     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2609. !     XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
  2610. !     XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2611. !     XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
  2612. !     lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs);
  2613. !     ClearCallbacks();
  2614. !     /*
  2615. !      *    On one month
  2616. !      *    label ">" from reources
  2617. !      */
  2618. !     callbacks[0].callback = MakeNewMonth;
  2619. !     callbacks[0].closure = (caddr_t)DateSum(td, 1);
  2620. !     nargs = 0;
  2621. !     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2622. !     XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
  2623. !     XtSetArg(args[nargs], XtNleft, XtChainRight); nargs++;
  2624. !     XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
  2625. !     lw = XtCreateManagedWidget("next", commandWidgetClass, dw, args, nargs);
  2626. !     ClearCallbacks();
  2627. !     /*
  2628. !      *    Help button
  2629. !      *    label help from resources
  2630. !      */
  2631. !     if (appResources.giveHelp)
  2632. !     {    
  2633. !         callbacks[0].callback = StripHelp;
  2634. !         callbacks[0].closure = (caddr_t)0;
  2635. !         nargs = 0;
  2636. !         XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2637. !         XtSetArg(args[nargs], XtNshowGrip, False); nargs++;
  2638. !         lw = XtCreateManagedWidget("help", commandWidgetClass, mon, args, nargs);
  2639. !         ClearCallbacks();
  2640.       }
  2641.   
  2642.   #ifdef    LONG_IS_32_BITS
  2643. --- 245,258 ----
  2644.       XtSetArg(args[nargs], XtNdefaultDistance, 2); nargs++;
  2645.       dw = XtCreateManagedWidget("action", formWidgetClass, mon, args, nargs);
  2646.   
  2647. !     switch (type)
  2648. !     {
  2649. !     case ME_MONTHLY:
  2650. !         CreateActionBar(shell, dw, mon, td);
  2651. !         break;
  2652. !     case ME_WEEKLY:
  2653. !         CreateWeeklyActionBar(shell, dw);
  2654. !         break;
  2655.       }
  2656.   
  2657.   #ifdef    LONG_IS_32_BITS
  2658. ***************
  2659. *** 248,265 ****
  2660.       callbacks[0].callback = YmBack;
  2661.       callbacks[1].callback = DayBack;
  2662.   #endif
  2663. !     for (i = 1; i <= numberOfDays; i++)
  2664.       {
  2665. !         dayStr = appResources.day[thisDay];
  2666. !         (void) sprintf(nbuf, "%2d %s", i, dayStr);
  2667. !         thisDay = (thisDay+1)%7;
  2668. !         
  2669.   #ifdef LONG_IS_32_BITS
  2670. !         callbacks[0].closure = (caddr_t)DatePack(i, td->month, td->year);
  2671.   #else
  2672.           callbacks[0].closure = (caddr_t)DatePack(td->month, td->year);
  2673. !         callbacks[1].closure = (caddr_t)i;
  2674.   #endif        
  2675.           /*
  2676.            *    Each line in the strip is
  2677.            *    form containing
  2678. --- 261,287 ----
  2679.       callbacks[0].callback = YmBack;
  2680.       callbacks[1].callback = DayBack;
  2681.   #endif
  2682. !     for (i = startLoop; i <= numberOfDays; i++)
  2683.       {
  2684. !         dayStr = appResources.sday[thisDay];
  2685. !         switch(type)
  2686. !         {
  2687. !         case ME_MONTHLY:
  2688. !             (void) sprintf(nbuf, "%2d %s", i, dayStr);
  2689. !             break;
  2690. !         case ME_WEEKLY:
  2691. !             (void) strcpy(nbuf, dayStr);
  2692. !             break;
  2693. !         }
  2694.   #ifdef LONG_IS_32_BITS
  2695. !         callbacks[0].closure = (caddr_t)DatePack(thisDay, i, td->month, td->year);
  2696.   #else
  2697.           callbacks[0].closure = (caddr_t)DatePack(td->month, td->year);
  2698. !         callbacks[1].closure = (caddr_t)DayPack(thisDay, i);
  2699.   #endif        
  2700. +         thisDay = (thisDay+1)%7;
  2701. +         
  2702.           /*
  2703.            *    Each line in the strip is
  2704.            *    form containing
  2705. ***************
  2706. *** 288,294 ****
  2707.            *    highlighting we get them after we have created the
  2708.            *    widget. Then we highlight today.
  2709.            */
  2710. !         if (markThisMonth && today.day == i)
  2711.           {
  2712.               nargs = 0;
  2713.               XtSetArg(args[nargs], XtNforeground, &ins->i_col.fg); nargs++;
  2714. --- 310,318 ----
  2715.            *    highlighting we get them after we have created the
  2716.            *    widget. Then we highlight today.
  2717.            */
  2718. !         if (markThisMonth &&
  2719. !             ((type == ME_MONTHLY && today.day == i) ||
  2720. !              (type == ME_WEEKLY && today.wday == i)))
  2721.           {
  2722.               nargs = 0;
  2723.               XtSetArg(args[nargs], XtNforeground, &ins->i_col.fg); nargs++;
  2724. ***************
  2725. *** 372,377 ****
  2726. --- 396,517 ----
  2727.   }
  2728.   
  2729.   /*
  2730. +  *    Create action bar for normal monthly strip
  2731. +  */
  2732. + static void
  2733. + CreateActionBar(shell, dw, mon, td)
  2734. +     Widget    shell;
  2735. +     Widget    dw;
  2736. +     Widget    mon;
  2737. +     Date    *td;
  2738. + {
  2739. +     Widget        lw;
  2740. +     register Cardinal nargs;
  2741. +     Arg        args[8];
  2742. +     /*
  2743. +      *    back one month
  2744. +      *    label "<" from resources
  2745. +      */
  2746. +     callbacks[0].callback = MakeNewMonth;
  2747. +     callbacks[0].closure = (caddr_t)DateSum(td, -1);
  2748. +     nargs = 0;
  2749. +     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2750. +     XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
  2751. +     XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2752. +     XtSetArg(args[nargs], XtNright, XtChainLeft); nargs++;
  2753. +     lw = XtCreateManagedWidget("back", commandWidgetClass, dw, args, nargs);
  2754. +     ClearCallbacks();
  2755. +     /*
  2756. +      *    Quit button
  2757. +      *    label "quit" from resources
  2758. +      */
  2759. +     callbacks[0].callback = StripQuit;
  2760. +     callbacks[0].closure = (caddr_t)shell;
  2761. +     nargs = 0;
  2762. +     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2763. +     XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
  2764. +     XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2765. +     XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
  2766. +     lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs);
  2767. +     ClearCallbacks();
  2768. +     /*
  2769. +      *    On one month
  2770. +      *    label ">" from reources
  2771. +      */
  2772. +     callbacks[0].callback = MakeNewMonth;
  2773. +     callbacks[0].closure = (caddr_t)DateSum(td, 1);
  2774. +     nargs = 0;
  2775. +     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2776. +     XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
  2777. +     XtSetArg(args[nargs], XtNleft, XtChainRight); nargs++;
  2778. +     XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
  2779. +     lw = XtCreateManagedWidget("next", commandWidgetClass, dw, args, nargs);
  2780. +     ClearCallbacks();
  2781. +     /*
  2782. +      *    Help button
  2783. +      *    label help from resources
  2784. +      */
  2785. +     if (appResources.giveHelp)
  2786. +     {    
  2787. +         callbacks[0].callback = StripHelp;
  2788. +         callbacks[0].closure = (caddr_t)0;
  2789. +         nargs = 0;
  2790. +         XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2791. +         XtSetArg(args[nargs], XtNshowGrip, False); nargs++;
  2792. +         lw = XtCreateManagedWidget("help", commandWidgetClass, mon, args, nargs);
  2793. +         ClearCallbacks();
  2794. +     }
  2795. + }
  2796. + /*
  2797. +  *    Create action bar for normal monthly strip
  2798. +  */
  2799. + static void
  2800. + CreateWeeklyActionBar(shell, dw)
  2801. +     Widget    shell;
  2802. +     Widget    dw;
  2803. + {
  2804. +     Widget        lw;
  2805. +     register Cardinal nargs;
  2806. +     Arg        args[8];
  2807. +     /*
  2808. +      *    Quit button
  2809. +      *    label "quit" from resources
  2810. +      */
  2811. +     callbacks[0].callback = StripQuit;
  2812. +     callbacks[0].closure = (caddr_t)shell;
  2813. +     nargs = 0;
  2814. +     XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2815. +     XtSetArg(args[nargs], XtNfromHoriz, NULL); nargs++;
  2816. +     XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2817. +     XtSetArg(args[nargs], XtNright, appResources.giveHelp ? XtChainLeft: XtChainRight); nargs++;
  2818. +     lw = XtCreateManagedWidget("quit", commandWidgetClass, dw, args, nargs);
  2819. +     ClearCallbacks();
  2820. +     /*
  2821. +      *    Help button
  2822. +      *    label help from resources
  2823. +      */
  2824. +     if (appResources.giveHelp)
  2825. +     {    
  2826. +         callbacks[0].callback = WeeklyHelp;
  2827. +         callbacks[0].closure = (caddr_t)0;
  2828. +         nargs = 0;
  2829. +         XtSetArg(args[nargs], XtNcallback, callbacks); nargs++;
  2830. +         XtSetArg(args[nargs], XtNfromHoriz, lw); nargs++;
  2831. +         XtSetArg(args[nargs], XtNleft, XtChainLeft); nargs++;
  2832. +         XtSetArg(args[nargs], XtNright, XtChainRight); nargs++;
  2833. +         lw = XtCreateManagedWidget("help", commandWidgetClass, dw, args, nargs);
  2834. +         ClearCallbacks();
  2835. +     }
  2836. + }
  2837. + /*
  2838.    *    Called when the date changes to ensure that
  2839.    *    the correct day has the appropriate highlights
  2840.    */
  2841. ***************
  2842. *** 445,451 ****
  2843.           y++;
  2844.       }
  2845.   #ifdef LONG_IS_32_BITS
  2846. !     return(DatePack(0, m, y));
  2847.   #else
  2848.       return(DatePack(m, y));
  2849.   #endif
  2850. --- 585,591 ----
  2851.           y++;
  2852.       }
  2853.   #ifdef LONG_IS_32_BITS
  2854. !     return(DatePack(0, 0, m, y));
  2855.   #else
  2856.       return(DatePack(m, y));
  2857.   #endif
  2858. ***************
  2859. *** 465,474 ****
  2860.   #ifdef LONG_IS_32_BITS
  2861.       callb.month = MoUnpack((Cardinal)closure);
  2862.       callb.year = YrUnpack((Cardinal)closure);
  2863. -     callb.day = DyUnpack((Cardinal)closure);
  2864. - #else
  2865. -     callb.day = (Cardinal)closure;
  2866.   #endif
  2867.       StartEditing(w, &callb);
  2868.   }
  2869.   
  2870. --- 605,613 ----
  2871.   #ifdef LONG_IS_32_BITS
  2872.       callb.month = MoUnpack((Cardinal)closure);
  2873.       callb.year = YrUnpack((Cardinal)closure);
  2874.   #endif
  2875. +     callb.day = DyUnpack((Cardinal)closure);
  2876. +     callb.wday = WdUnpack((Cardinal)closure);
  2877.       StartEditing(w, &callb);
  2878.   }
  2879.   
  2880.  
  2881. --
  2882. Dan Heller
  2883. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  2884. Senior Writer                President          comp-sources.x@uunet.uu.net
  2885. argv@ora.com                 argv@zipcode.com
  2886.